[lld] r323395 - Use lookup instead of find. NFC, just simpler.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 17:29:15 PST 2018
Author: rafael
Date: Wed Jan 24 17:29:15 2018
New Revision: 323395
URL: http://llvm.org/viewvc/llvm-project?rev=323395&view=rev
Log:
Use lookup instead of find. NFC, just simpler.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=323395&r1=323394&r2=323395&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Jan 24 17:29:15 2018
@@ -617,9 +617,8 @@ MemoryRegion *LinkerScript::findMemoryRe
// If a memory region name was specified in the output section command,
// then try to find that region first.
if (!Sec->MemoryRegionName.empty()) {
- auto It = MemoryRegions.find(Sec->MemoryRegionName);
- if (It != MemoryRegions.end())
- return It->second;
+ if (MemoryRegion *M = MemoryRegions.lookup(Sec->MemoryRegionName))
+ return M;
error("memory region '" + Sec->MemoryRegionName + "' not declared");
return nullptr;
}
More information about the llvm-commits
mailing list