[clang] abfb340 - [Analysis] Avoid repeated hash lookups (NFC) (#107357)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 5 08:35:49 PDT 2024
Author: Kazu Hirata
Date: 2024-09-05T08:35:46-07:00
New Revision: abfb340b779f2b20009fe42ebc522417adf79c44
URL: https://github.com/llvm/llvm-project/commit/abfb340b779f2b20009fe42ebc522417adf79c44
DIFF: https://github.com/llvm/llvm-project/commit/abfb340b779f2b20009fe42ebc522417adf79c44.diff
LOG: [Analysis] Avoid repeated hash lookups (NFC) (#107357)
Added:
Modified:
clang/lib/Analysis/ThreadSafety.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index c4a83b069e0792..5577f45aa5217f 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -1180,8 +1180,7 @@ void BeforeSet::checkBeforeAfter(const ValueDecl* StartVd,
}
// Transitively search other before sets, and warn on cycles.
if (traverse(Vdb)) {
- if (!CycMap.contains(Vd)) {
- CycMap.insert(std::make_pair(Vd, true));
+ if (CycMap.try_emplace(Vd, true).second) {
StringRef L1 = Vd->getName();
Analyzer.Handler.handleBeforeAfterCycle(L1, Vd->getLocation());
}
More information about the cfe-commits
mailing list