[lld] r207791 - [PECOFF] Do not call addDllExport to mutate export descriptors.
Rui Ueyama
ruiu at google.com
Thu May 1 13:40:30 PDT 2014
Author: ruiu
Date: Thu May 1 15:40:30 2014
New Revision: 207791
URL: http://llvm.org/viewvc/llvm-project?rev=207791&view=rev
Log:
[PECOFF] Do not call addDllExport to mutate export descriptors.
This is more efficient than before.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp?rev=207791&r1=207790&r2=207791&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp Thu May 1 15:40:30 2014
@@ -65,9 +65,8 @@ static bool getExportedAtoms(PECOFFLinki
for (const DefinedAtom *atom : file->defined())
definedAtoms[removeAtSignSuffix(atom->name())] = atom;
- std::set<PECOFFLinkingContext::ExportDesc> exports = ctx.getDllExports();
- ctx.getDllExports().clear();
- for (PECOFFLinkingContext::ExportDesc desc : exports) {
+ std::set<PECOFFLinkingContext::ExportDesc> exports;
+ for (PECOFFLinkingContext::ExportDesc desc : ctx.getDllExports()) {
auto it = definedAtoms.find(desc.name);
if (it == definedAtoms.end()) {
llvm::errs() << "Symbol <" << desc.name
@@ -77,8 +76,9 @@ static bool getExportedAtoms(PECOFFLinki
const DefinedAtom *atom = it->second;
ret.push_back(TableEntry(desc.name, desc.ordinal, atom, desc.noname));
desc.internalName = removeLeadingUnderscore(atom->name());
- ctx.addDllExport(desc);
+ exports.insert(desc);
}
+ ctx.getDllExports().swap(exports);
std::sort(ret.begin(), ret.end(), compare);
return true;
}
More information about the llvm-commits
mailing list