1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[lto] added getCOFFWeakExternalFallback

Summary: This allows clients of the LTO API to determine the name of the fallback symbol for COFF weak externals.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mehdi_amini

Differential Revision: https://reviews.llvm.org/D29365

llvm-svn: 293960
This commit is contained in:
Bob Haarman 2017-02-02 23:10:22 +00:00
parent b5c776edaf
commit 8e090cdb07

View File

@ -152,6 +152,22 @@ public:
skip();
}
/// For COFF weak externals, returns the name of the symbol that is used
/// as a fallback if the weak external remains undefined.
std::string getCOFFWeakExternalFallback() const {
assert((Flags & object::BasicSymbolRef::SF_Weak) &&
(Flags & object::BasicSymbolRef::SF_Indirect) &&
"symbol is not a weak external");
std::string Name;
raw_string_ostream OS(Name);
SymTab.printSymbolName(
OS,
cast<GlobalValue>(
cast<GlobalAlias>(getGV())->getAliasee()->stripPointerCasts()));
OS.flush();
return Name;
}
/// Returns the mangled name of the global.
StringRef getName() const { return Name; }