llvm.org GIT mirror llvm / b074e3f
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293960 91177308-0d34-0410-b5e6-96231b3b80d8 Bob Haarman 3 years ago
1 changed file(s) with 16 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
149149 const ModuleSymbolTable &SymTab, const InputFile *File)
150150 : I(I), SymTab(SymTab), File(File) {
151151 skip();
152 }
153
154 /// For COFF weak externals, returns the name of the symbol that is used
155 /// as a fallback if the weak external remains undefined.
156 std::string getCOFFWeakExternalFallback() const {
157 assert((Flags & object::BasicSymbolRef::SF_Weak) &&
158 (Flags & object::BasicSymbolRef::SF_Indirect) &&
159 "symbol is not a weak external");
160 std::string Name;
161 raw_string_ostream OS(Name);
162 SymTab.printSymbolName(
163 OS,
164 cast(
165 cast(getGV())->getAliasee()->stripPointerCasts()));
166 OS.flush();
167 return Name;
152168 }
153169
154170 /// Returns the mangled name of the global.