[llvm] r284408 - Return a StringRef instead of a Comdat*.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 17 11:51:03 PDT 2016
Author: rafael
Date: Mon Oct 17 13:51:02 2016
New Revision: 284408
URL: http://llvm.org/viewvc/llvm-project?rev=284408&view=rev
Log:
Return a StringRef instead of a Comdat*.
This is a small step in making this interface compatible with an
bitcode symbol table.
Modified:
llvm/trunk/include/llvm/LTO/LTO.h
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/include/llvm/LTO/LTO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/LTO.h?rev=284408&r1=284407&r2=284408&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/LTO.h (original)
+++ llvm/trunk/include/llvm/LTO/LTO.h Mon Oct 17 13:51:02 2016
@@ -176,10 +176,9 @@ public:
return GV && GV->isThreadLocal();
}
- //FIXME: We shouldn't expose this information.
- Expected<const Comdat *> getComdat() const {
+ Expected<StringRef> getComdat() const {
if (!GV)
- return nullptr;
+ return "";
const GlobalObject *GO;
if (auto *GA = dyn_cast<GlobalAlias>(GV)) {
GO = GA->getBaseObject();
@@ -189,9 +188,9 @@ public:
} else {
GO = cast<GlobalObject>(GV);
}
- if (GO)
- return GO->getComdat();
- return nullptr;
+ if (const Comdat *C = GO->getComdat())
+ return C->getName();
+ return "";
}
uint64_t getCommonSize() const {
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=284408&r1=284407&r2=284408&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Mon Oct 17 13:51:02 2016
@@ -526,9 +526,9 @@ static ld_plugin_status claim_file_hook(
sym.size = 0;
sym.comdat_key = nullptr;
- const Comdat *C = check(Sym.getComdat());
- if (C)
- sym.comdat_key = strdup(C->getName().str().c_str());
+ StringRef C = check(Sym.getComdat());
+ if (!C.empty())
+ sym.comdat_key = strdup(C.str().c_str());
sym.resolution = LDPR_UNKNOWN;
}
More information about the llvm-commits
mailing list