diff options
-rw-r--r-- | llvm/include/llvm/LTO/LTO.h | 11 | ||||
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 6 |
2 files changed, 8 insertions, 9 deletions
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h index e885c93b6ac..b2679af3909 100644 --- a/llvm/include/llvm/LTO/LTO.h +++ b/llvm/include/llvm/LTO/LTO.h @@ -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 { diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 9bdc7abc5b4..055c462e69a 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -526,9 +526,9 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, 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; } |