Return a StringRef from getSection.
This is similar to how getName is handled.
llvm-svn: 269218
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index d69e8d5..0c6c6f5 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -1485,7 +1485,9 @@
}
const char *LLVMGetSection(LLVMValueRef Global) {
- return unwrap<GlobalValue>(Global)->getSection();
+ // Using .data() is safe because of how GlobalObject::setSection is
+ // implemented.
+ return unwrap<GlobalValue>(Global)->getSection().data();
}
void LLVMSetSection(LLVMValueRef Global, const char *Section) {