Skip to content

Commit

Permalink
Return a StringRef instead of a Comdat*.
Browse files Browse the repository at this point in the history
This is a small step in making this interface compatible with an
bitcode symbol table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284408 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Oct 17, 2016
1 parent 087ac0b commit 58121fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions include/llvm/LTO/LTO.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,9 @@ class InputFile {
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();
Expand All @@ -189,9 +188,9 @@ class InputFile {
} 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 {
Expand Down
6 changes: 3 additions & 3 deletions tools/gold/gold-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 58121fb

Please sign in to comment.