Make isExtern() be a virtual function inherited from GlobalValue
authorChris Lattner <sabre@nondot.org>
Wed, 9 Oct 2002 23:11:33 +0000 (23:11 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 9 Oct 2002 23:11:33 +0000 (23:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4101 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Function.h
include/llvm/GlobalValue.h
include/llvm/GlobalVariable.h

index 4c0e0ec5235c52f9ee46441bd56b2ffd3f5690bd..87e6bad48a330608c252493690a1d16fe16159af 100644 (file)
@@ -85,7 +85,7 @@ public:
   /// is empty if so) this is true for external functions, defined as forward
   /// "declare"ations
   ///
-  bool isExternal() const { return BasicBlocks.empty(); }
+  virtual bool isExternal() const { return BasicBlocks.empty(); }
 
   // getNext/Prev - Return the next or previous function in the list.  These
   // methods should never be used directly, and are only used to implement the
index 56e4a3e28a1ae9df8dea6313b6f3fe2fbbb0ff8e..af2ff23c82edfedc56fbea6dcb7dc02e0d0a059c 100644 (file)
@@ -26,17 +26,22 @@ protected:
 public:
   ~GlobalValue() {}
 
-  // getType - Global values are always pointers.
+  /// getType - Global values are always pointers.
   inline const PointerType *getType() const {
     return (const PointerType*)User::getType();
   }
 
-  // Internal Linkage - True if the global value is inaccessible to 
+  /// Internal Linkage - True if the global value is inaccessible to 
   bool hasInternalLinkage() const { return HasInternalLinkage; }
   bool hasExternalLinkage() const { return !HasInternalLinkage; }
   void setInternalLinkage(bool HIL) { HasInternalLinkage = HIL; }
 
-  // Get the module that this global value is contained inside of...
+  /// isExternal - Return true if the primary definition of this global value is
+  /// outside of the current translation unit...
+  virtual bool isExternal() const = 0;
+
+  /// getParent - Get the module that this global value is contained inside
+  /// of...
   inline Module *getParent() { return Parent; }
   inline const Module *getParent() const { return Parent; }
 
index 12862cc4f6639a2dff5ac269911ca80faef9d57c..372b7a25e66c975f369ee04b348888fe680e12be 100644 (file)
@@ -46,7 +46,7 @@ public:
   /// global variable is defined in some other translation unit, and is thus
   /// externally defined here.
   ///
-  bool isExternal() const { return Operands.empty(); }
+  virtual bool isExternal() const { return Operands.empty(); }
 
   /// hasInitializer - Unless a global variable isExternal(), it has an
   /// initializer.  The initializer for the global variable/constant is held by