[lld] r327272 - [ELF] - Removed excessive lookup. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 12 07:15:38 PDT 2018
Author: grimar
Date: Mon Mar 12 07:15:38 2018
New Revision: 327272
URL: http://llvm.org/viewvc/llvm-project?rev=327272&view=rev
Log:
[ELF] - Removed excessive lookup. NFC.
Modified:
lld/trunk/ELF/ScriptParser.cpp
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=327272&r1=327271&r2=327272&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Mon Mar 12 07:15:38 2018
@@ -1321,11 +1321,10 @@ void ScriptParser::readMemory() {
uint64_t Length = readMemoryAssignment("LENGTH", "len", "l");
// Add the memory region to the region map.
- if (Script->MemoryRegions.count(Name))
- setError("region '" + Name + "' already defined");
MemoryRegion *MR =
make<MemoryRegion>(Name, Origin, Length, Flags, NegFlags);
- Script->MemoryRegions[Name] = MR;
+ if (!Script->MemoryRegions.insert({Name, MR}).second)
+ setError("region '" + Name + "' already defined");
}
}
More information about the llvm-commits
mailing list