diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 2265e4c2b72..f97602015f1 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -80,6 +80,12 @@ void GlobalValue::setAlignment(unsigned Align) { assert(getAlignment() == Align && "Alignment representation error!"); } +const std::string &GlobalValue::getSection() const { + if (auto *GA = dyn_cast<GlobalAlias>(this)) + return GA->getAliasedGlobal()->getSection(); + return Section; +} + void GlobalValue::setSection(StringRef S) { assert(!isa<GlobalAlias>(this) && "GlobalAlias should not have a section!"); Section = S; diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index bc378aed16b..083f7b5255e 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -476,7 +476,6 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) { Assert1(GA.getType() == GA.getAliasee()->getType(), "Alias and aliasee types should match!", &GA); Assert1(!GA.hasUnnamedAddr(), "Alias cannot have unnamed_addr!", &GA); - Assert1(!GA.hasSection(), "Alias cannot have a section!", &GA); const Constant *Aliasee = GA.getAliasee(); const GlobalValue *GV = dyn_cast<GlobalValue>(Aliasee); |