Skip to content

Commit abfb340

Browse files
[Analysis] Avoid repeated hash lookups (NFC) (#107357)
1 parent aea3b0f commit abfb340

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/Analysis/ThreadSafety.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,7 @@ void BeforeSet::checkBeforeAfter(const ValueDecl* StartVd,
11801180
}
11811181
// Transitively search other before sets, and warn on cycles.
11821182
if (traverse(Vdb)) {
1183-
if (!CycMap.contains(Vd)) {
1184-
CycMap.insert(std::make_pair(Vd, true));
1183+
if (CycMap.try_emplace(Vd, true).second) {
11851184
StringRef L1 = Vd->getName();
11861185
Analyzer.Handler.handleBeforeAfterCycle(L1, Vd->getLocation());
11871186
}

0 commit comments

Comments
 (0)