Implement "internal vs external linkage" which corresponds to the C notion of static
authorChris Lattner <sabre@nondot.org>
Mon, 26 Nov 2001 18:46:40 +0000 (18:46 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 26 Nov 2001 18:46:40 +0000 (18:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1362 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 11e823be9ba569536f162ceeeef21004504f93bd..f2b0b48a745b1aa518f0865551a3c90914fe847e 100644 (file)
@@ -42,7 +42,7 @@ private:
   void setParent(Module *parent);
 
 public:
-  Method(const MethodType *Ty, const string &Name = "");
+  Method(const MethodType *Ty, bool isInternal, const string &Name = "");
   ~Method();
 
   // Specialize setName to handle symbol table majik...
index baee0bf4e085c5a99e6c9c8842ae0420fc19bd18..d6a977bd372aec5594eb4a2cbe8c29fcfb9e57bd 100644 (file)
@@ -16,9 +16,11 @@ class PointerType;
 class GlobalValue : public User {
   GlobalValue(const GlobalValue &);             // do not implement
 protected:
-  GlobalValue(const Type *Ty, ValueTy vty, const string &name = "")
-    : User(Ty, vty, name) { Parent = 0; }
+  GlobalValue(const Type *Ty, ValueTy vty, bool hasInternalLinkage,
+             const string &name = "")
+    : User(Ty, vty, name), HasInternalLinkage(hasInternalLinkage), Parent(0) {}
 
+  bool HasInternalLinkage;    // Is this value accessable externally?
   Module *Parent;
 public:
   ~GlobalValue() {}
@@ -28,6 +30,11 @@ public:
     return (const PointerType*)User::getType();
   }
 
+  // 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...
   inline Module *getParent() { return Parent; }
   inline const Module *getParent() const { return Parent; }
index cce4aaceae3f32c1cea9a9607460fa06e1d2fe79..2be424dbd5d4ae8d03aaeec71cccabcee4e9078d 100644 (file)
@@ -24,8 +24,8 @@ class GlobalVariable : public GlobalValue {
 
   bool Constant;                   // Is this a global constant?
 public:
-  GlobalVariable(const Type *Ty, bool isConstant, ConstPoolVal *Initializer = 0,
-                const string &Name = "");
+  GlobalVariable(const Type *Ty, bool isConstant, bool isInternal,
+                ConstPoolVal *Initializer = 0, const string &Name = "");
   ~GlobalVariable() {}
 
   // Specialize setName to handle symbol table majik...