From 9e333e976e88d46cf8d86d00a87706dc6ea8974b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 25 Jan 2018 01:29:15 +0000 Subject: [PATCH] Use lookup instead of find. NFC, just simpler. llvm-svn: 323395 --- lld/ELF/LinkerScript.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 33a618952456..fb8b5ad78a53 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -617,9 +617,8 @@ MemoryRegion *LinkerScript::findMemoryRegion(OutputSection *Sec) { // 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; }