[clang] [clang][mutation analyzer][NFC] Simplify code in ExprMutationAnalyzer (PR #125283)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 31 12:15:10 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-analysis

Author: Balazs Benics (steakhal)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/125283.diff


1 Files Affected:

- (modified) clang/lib/Analysis/ExprMutationAnalyzer.cpp (+1-4) 


``````````diff
diff --git a/clang/lib/Analysis/ExprMutationAnalyzer.cpp b/clang/lib/Analysis/ExprMutationAnalyzer.cpp
index d7b44149d0fc4b..93376eb9b93c72 100644
--- a/clang/lib/Analysis/ExprMutationAnalyzer.cpp
+++ b/clang/lib/Analysis/ExprMutationAnalyzer.cpp
@@ -813,10 +813,7 @@ FunctionParmMutationAnalyzer::findMutation(const ParmVarDecl *Parm) {
   // before analyzing parameters of A. Then when analyzing the second "call A",
   // FunctionParmMutationAnalyzer can use this memoized value to avoid infinite
   // recursion.
-  Results[Parm] = nullptr;
-  if (const Stmt *S = BodyAnalyzer.findMutation(Parm))
-    return Results[Parm] = S;
-  return Results[Parm];
+  return Results[Parm] = BodyAnalyzer.findMutation(Parm);
 }
 
 } // namespace clang

``````````

</details>


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


More information about the cfe-commits mailing list