diff options
-rw-r--r-- | llvm/include/llvm/IR/GlobalValue.h | 6 | ||||
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h index 09c9fe06aba..7c4dd0796ce 100644 --- a/llvm/include/llvm/IR/GlobalValue.h +++ b/llvm/include/llvm/IR/GlobalValue.h @@ -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 { diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 0b49350e551..76baa6202a7 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -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)) |