[lld] r342205 - [COFF] Avoid copying of chunk vectors. NFC.
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 13 23:08:51 PDT 2018
Author: mstorsjo
Date: Thu Sep 13 23:08:51 2018
New Revision: 342205
URL: http://llvm.org/viewvc/llvm-project?rev=342205&view=rev
Log:
[COFF] Avoid copying of chunk vectors. NFC.
When declaring the pair variable as "auto Pair : Map", it is
effectively declared as
std::pair<std::pair<StringRef, uint32_t>, std::vector<Chunk *>>.
This effectively does a full, shallow copy of the Chunk vector,
just to be thrown away after each iteration.
Differential Revision: https://reviews.llvm.org/D52051
Modified:
lld/trunk/COFF/Writer.cpp
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=342205&r1=342204&r2=342205&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Thu Sep 13 23:08:51 2018
@@ -469,7 +469,7 @@ void Writer::createSections() {
// '$' and all following characters in input section names are
// discarded when determining output section. So, .text$foo
// contributes to .text, for example. See PE/COFF spec 3.2.
- for (auto Pair : Map) {
+ for (auto &Pair : Map) {
StringRef Name = getOutputSectionName(Pair.first.first);
uint32_t OutChars = Pair.first.second;
More information about the llvm-commits
mailing list