llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Gábor Spaits (spaits)

<details>
<summary>Changes</summary>

`PRValueHandler`'s handle function is only called from Tracker's track 
function. In `Tracker::track` the
`ExprNode` parameter passed to `PRValueHandler::handle` is already the 
`ExplodedNode` for the tracked expression. We do not need to calculate that 
again.

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


1 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (+4-8) 


``````````diff
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp 
b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 4a9d130c240aec..4a1607530dbd82 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2565,21 +2565,17 @@ class PRValueHandler final : public ExpressionHandler {
   using ExpressionHandler::ExpressionHandler;
 
   Tracker::Result handle(const Expr *E, const ExplodedNode *InputNode,
-                         const ExplodedNode *ExprNode,
+                         const ExplodedNode *RVNode,
                          TrackingOptions Opts) override {
-    if (!E->isPRValue())
-      return {};
-
-    const ExplodedNode *RVNode = findNodeForExpression(ExprNode, E);
-    if (!RVNode)
+    if (!E->isPRValue() || !RVNode)
       return {};
 
     Tracker::Result CombinedResult;
     Tracker &Parent = getParentTracker();
 
-    const auto track = [&CombinedResult, &Parent, ExprNode,
+    const auto track = [&CombinedResult, &Parent, RVNode,
                         Opts](const Expr *Inner) {
-      CombinedResult.combineWith(Parent.track(Inner, ExprNode, Opts));
+      CombinedResult.combineWith(Parent.track(Inner, RVNode, Opts));
     };
 
     // FIXME: Initializer lists can appear in many different contexts

``````````

</details>


https://github.com/llvm/llvm-project/pull/75076
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to