diff options
author | Kazu Hirata <kazu@google.com> | 2024-09-28 10:03:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-28 10:03:23 -0700 |
commit | 60a6e6fa54b79d0771f36b4f9565cb6b465b7501 (patch) | |
tree | 157377909fb52751aa88745ac77ee6ba09b6fb7c /llvm/lib/Object/ArchiveWriter.cpp | |
parent | 1c2ed36741c6bc3921d2566123019079c4249c1a (diff) | |
download | llvm-60a6e6fa54b79d0771f36b4f9565cb6b465b7501.zip llvm-60a6e6fa54b79d0771f36b4f9565cb6b465b7501.tar.gz llvm-60a6e6fa54b79d0771f36b4f9565cb6b465b7501.tar.bz2 |
[Object] Avoid repeated map lookups (NFC) (#110201)
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r-- | llvm/lib/Object/ArchiveWriter.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp index 1140455..c61ba86 100644 --- a/llvm/lib/Object/ArchiveWriter.cpp +++ b/llvm/lib/Object/ArchiveWriter.cpp @@ -754,9 +754,8 @@ static Expected<std::vector<unsigned>> getSymbols(SymbolicFile *Obj, raw_string_ostream NameStream(Name); if (Error E = S.printName(NameStream)) return std::move(E); - if (Map->find(Name) != Map->end()) + if (!Map->try_emplace(Name, Index).second) continue; // ignore duplicated symbol - (*Map)[Name] = Index; if (Map == &SymMap->Map) { Ret.push_back(SymNames.tell()); SymNames << Name << '\0'; |