[clang] [clang-tools-extra] [clang-tidy] Fix performance-unnecessary-value-param (PR #109145)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 18 07:16:10 PDT 2024


================
@@ -118,10 +118,19 @@ class FunctionParmMutationAnalyzer {
   static FunctionParmMutationAnalyzer *
   getFunctionParmMutationAnalyzer(const FunctionDecl &Func, ASTContext &Context,
                                   ExprMutationAnalyzer::Memoized &Memorized) {
-    auto [it, Inserted] = Memorized.FuncParmAnalyzer.try_emplace(&Func);
-    if (Inserted)
-      it->second = std::unique_ptr<FunctionParmMutationAnalyzer>(
-          new FunctionParmMutationAnalyzer(Func, Context, Memorized));
+    auto it = Memorized.FuncParmAnalyzer.find(&Func);
+    if (it == Memorized.FuncParmAnalyzer.end())
----------------
nikic wrote:

Given the monster comment, I'd add braces in this case.

https://github.com/llvm/llvm-project/pull/109145


More information about the cfe-commits mailing list