Skip to content

Commit 22aeec3

Browse files
[Analysis] Avoid repeated hash lookups (NFC) (#108674)
1 parent 8bce263 commit 22aeec3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,10 @@ class FunctionParmMutationAnalyzer {
118118
static FunctionParmMutationAnalyzer *
119119
getFunctionParmMutationAnalyzer(const FunctionDecl &Func, ASTContext &Context,
120120
ExprMutationAnalyzer::Memoized &Memorized) {
121-
auto it = Memorized.FuncParmAnalyzer.find(&Func);
122-
if (it == Memorized.FuncParmAnalyzer.end())
123-
it =
124-
Memorized.FuncParmAnalyzer
125-
.try_emplace(&Func, std::unique_ptr<FunctionParmMutationAnalyzer>(
126-
new FunctionParmMutationAnalyzer(
127-
Func, Context, Memorized)))
128-
.first;
121+
auto [it, Inserted] = Memorized.FuncParmAnalyzer.try_emplace(&Func);
122+
if (Inserted)
123+
it->second = std::unique_ptr<FunctionParmMutationAnalyzer>(
124+
new FunctionParmMutationAnalyzer(Func, Context, Memorized));
129125
return it->getSecond().get();
130126
}
131127

0 commit comments

Comments
 (0)