=?utf-8?q?Donát?= Nagy <[email protected]> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
llvmorg-github-actions[bot] wrote: <!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-static-analyzer-1 Author: Donát Nagy (NagyDonat) <details> <summary>Changes</summary> The method `CoreEngine::makeNode` is the canonical way of creating a new node in the exploded graph and connecting it to its predecessor. Apply it in two locations that previously duplicated its logic. This change is very close to being NFC, but could technically change the behavior if the state is `PosteriorlyOverconstrained` (which is vanishingly rare). --- Full diff: https://github.com/llvm/llvm-project/pull/218462.diff 1 Files Affected: - (modified) clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (+4-12) ``````````diff diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index e0139484b2b48..3ff75fa3167c5 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -53,14 +53,10 @@ void ExprEngine::processCallEnter(CallEnter CE, ExplodedNode *Pred) { // Construct an edge representing the starting location in the callee. BlockEdge Loc(Entry, Succ, CE.getCalleeStackFrame()); - ProgramStateRef state = Pred->getState(); - // Construct a new node, notify checkers that analysis of the function has // begun, and add the resultant nodes to the worklist. - bool isNew; - ExplodedNode *Node = G.getNode(Loc, state, false, &isNew); - Node->addPredecessor(Pred, G); - if (isNew) { + ExplodedNode *Node = Engine.makeNode(Loc, Pred->getState(), Pred); + if (Node) { // FIXME: In the `processBeginOfFunction` callback // `ExprEngine::getCurrStackFrame()` can be different from the // `StackFrame` queried from e.g. the `ExplodedNode`s. I'm not @@ -545,12 +541,8 @@ void ExprEngine::inlineCall(WorkList *WList, const CallEvent &Call, // formal arguments. State = State->enterStackFrame(Call, CalleeSF); - bool isNew; - if (ExplodedNode *N = G.getNode(Loc, State, false, &isNew)) { - N->addPredecessor(Pred, G); - if (isNew) - WList->enqueue(N); - } + if (ExplodedNode *N = Engine.makeNode(Loc, State, Pred)) + WList->enqueue(N); NumInlinedCalls++; Engine.FunctionSummaries->bumpNumTimesInlined(D); `````````` </details> https://github.com/llvm/llvm-project/pull/218462 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
