[llvm] r208095 - Be more strict about not allowing setSection on aliases.
Rafael Espindola
rafael.espindola at gmail.com
Tue May 6 07:59:14 PDT 2014
Author: rafael
Date: Tue May 6 09:59:14 2014
New Revision: 208095
URL: http://llvm.org/viewvc/llvm-project?rev=208095&view=rev
Log:
Be more strict about not allowing setSection on aliases.
Modified:
llvm/trunk/include/llvm/IR/GlobalValue.h
llvm/trunk/lib/IR/Globals.cpp
Modified: llvm/trunk/include/llvm/IR/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalValue.h?rev=208095&r1=208094&r2=208095&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalValue.h Tue May 6 09:59:14 2014
@@ -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 {
Modified: llvm/trunk/lib/IR/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=208095&r1=208094&r2=208095&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Globals.cpp (original)
+++ llvm/trunk/lib/IR/Globals.cpp Tue May 6 09:59:14 2014
@@ -73,6 +73,11 @@ void GlobalValue::setAlignment(unsigned
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))
More information about the llvm-commits
mailing list