summaryrefslogtreecommitdiff
path: root/lib/IR/Globals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/Globals.cpp')
-rw-r--r--lib/IR/Globals.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp
index 2265e4c2b7..f97602015f 100644
--- a/lib/IR/Globals.cpp
+++ b/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;