Be more strict about not allowing setSection on aliases.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 6 May 2014 14:59:14 +0000 (14:59 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 6 May 2014 14:59:14 +0000 (14:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208095 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/GlobalValue.h
lib/IR/Globals.cpp

index 09c9fe06aba5f3e411b02823157807cfe3788814..7c4dd0796ce05c963746e229c903b432946e4f55 100644 (file)
@@ -110,11 +110,7 @@ public:
 
   bool hasSection() const { return !Section.empty(); }
   const std::string &getSection() const { return Section; }
-  void setSection(StringRef S) {
-    assert((getValueID() != Value::GlobalAliasVal || S.empty()) &&
-           "GlobalAlias should not have a section!");
-    Section = S;
-  }
+  void setSection(StringRef S);
 
   /// getType - Global values are always pointers.
   inline PointerType *getType() const {
index 0b49350e5519db932c80044babda53d99636a9bf..76baa6202a7c6e5a0cc208a9312b7898bde748b5 100644 (file)
@@ -73,6 +73,11 @@ void GlobalValue::setAlignment(unsigned Align) {
   assert(getAlignment() == Align && "Alignment representation error!");
 }
 
+void GlobalValue::setSection(StringRef S) {
+  assert(!isa<GlobalAlias>(this) && "GlobalAlias should not have a section!");
+  Section = S;
+}
+
 bool GlobalValue::isDeclaration() const {
   // Globals are definitions if they have an initializer.
   if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this))