From: Rafael Espindola Date: Tue, 6 May 2014 14:59:14 +0000 (+0000) Subject: Be more strict about not allowing setSection on aliases. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4f1723522e25f0c99f359b5857399b8a989adb6c;p=oota-llvm.git Be more strict about not allowing setSection on aliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208095 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/GlobalValue.h b/include/llvm/IR/GlobalValue.h index 09c9fe06aba..7c4dd0796ce 100644 --- a/include/llvm/IR/GlobalValue.h +++ b/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/lib/IR/Globals.cpp b/lib/IR/Globals.cpp index 0b49350e551..76baa6202a7 100644 --- a/lib/IR/Globals.cpp +++ b/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(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(this))