Add r159136 back now that pr13124 has been fixed.
[oota-llvm.git] / include / llvm / IR / GlobalValue.h
index f398bc1b87ab713666c689004db051f25e12a014..a5049e4324c69996dd50192153e0a1f5a1eaa710 100644 (file)
@@ -19,6 +19,7 @@
 #define LLVM_IR_GLOBALVALUE_H
 
 #include "llvm/IR/Constant.h"
+#include "llvm/IR/DerivedTypes.h"
 
 namespace llvm {
 
@@ -105,7 +106,7 @@ public:
 
   /// getType - Global values are always pointers.
   inline PointerType *getType() const {
-    return reinterpret_cast<PointerType*>(User::getType());
+    return cast<PointerType>(User::getType());
   }
 
   static LinkageTypes getLinkOnceLinkage(bool ODR) {
@@ -121,6 +122,9 @@ public:
   static bool isAvailableExternallyLinkage(LinkageTypes Linkage) {
     return Linkage == AvailableExternallyLinkage;
   }
+  static bool isLinkOnceODRLinkage(LinkageTypes Linkage) {
+    return Linkage == LinkOnceODRLinkage;
+  }
   static bool isLinkOnceLinkage(LinkageTypes Linkage) {
     return Linkage == LinkOnceAnyLinkage ||
            Linkage == LinkOnceODRLinkage ||
@@ -201,6 +205,9 @@ public:
   bool hasAvailableExternallyLinkage() const {
     return isAvailableExternallyLinkage(Linkage);
   }
+  bool hasLinkOnceODRLinkage() const {
+    return isLinkOnceODRLinkage(Linkage);
+  }
   bool hasLinkOnceLinkage() const {
     return isLinkOnceLinkage(Linkage);
   }
@@ -238,6 +245,15 @@ public:
   /// create a GlobalValue) from the GlobalValue Src to this one.
   virtual void copyAttributesFrom(const GlobalValue *Src);
 
+  /// getRealLinkageName - If special LLVM prefix that is used to inform the asm
+  /// printer to not emit usual symbol prefix before the symbol name is used
+  /// then return linkage name after skipping this special LLVM prefix.
+  static StringRef getRealLinkageName(StringRef Name) {
+    if (!Name.empty() && Name[0] == '\1')
+      return Name.substr(1);
+    return Name;
+  }
+
 /// @name Materialization
 /// Materialization is used to construct functions only as they're needed. This
 /// is useful to reduce memory usage in LLVM or parsing work done by the