https://github.com/marco-milanese-sonarsource updated https://github.com/llvm/llvm-project/pull/220588
>From 765cb016953ba30e1bdf6bd8d8c3775dd353915b Mon Sep 17 00:00:00 2001 From: Marco Milanese <[email protected]> Date: Wed, 2 Sep 2026 15:06:53 +0200 Subject: [PATCH 1/2] [analyzer][NFC] Fix typo in `exploredAllPaths` variable & predicate --- .../clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h | 6 +++--- .../clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h | 2 +- .../lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp | 2 +- clang/lib/StaticAnalyzer/Core/CoreEngine.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h index 67bd1504d5ffb..05091c8ad64da 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h @@ -84,7 +84,7 @@ class CoreEngine { /// Whether the single-TU phase ran out of budget with work left over. /// The CTU phase replaces \c WList, so this has to be remembered separately. - bool exploredAllSTUPaths = false; + bool notExploredAllSTUPaths = false; /// The information about functions shared by the whole translation unit. /// (This data is owned by AnalysisConsumer.) @@ -150,8 +150,8 @@ class CoreEngine { // Functions for external checking of whether we have unfinished work. bool wasBlockAborted() const { return !blocksAborted.empty(); } bool wasBlocksExhausted() const { return !blocksExhausted.empty(); } - bool hasExploredAllPaths() const { - return wasBlocksExhausted() || WList->hasWork() || exploredAllSTUPaths || + bool hasNotExploredAllPaths() const { + return wasBlocksExhausted() || WList->hasWork() || notExploredAllSTUPaths || wasBlockAborted(); } diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index 195d63b0e0936..2e891cae75f1c 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -467,7 +467,7 @@ class ExprEngine { // Functions for external checking of whether we have unfinished work. bool wasBlocksExhausted() const { return Engine.wasBlocksExhausted(); } bool hasEmptyWorkList() const { return !Engine.getWorkList()->hasWork(); } - bool hasExploredAllPaths() const { return Engine.hasExploredAllPaths(); } + bool hasNotExploredAllPaths() const { return Engine.hasNotExploredAllPaths(); } const CoreEngine &getCoreEngine() const { return Engine; } diff --git a/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp index 57b079e40e6c4..3d2a2aa6d8b1c 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp @@ -51,7 +51,7 @@ void UnreachableCodeChecker::checkEndAnalysis(ExplodedGraph &G, ExprEngine &Eng) const { CFGBlocksSet reachable, visited; - if (Eng.hasExploredAllPaths()) + if (Eng.hasNotExploredAllPaths()) return; const Decl *D = nullptr; diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp index 593346b2354a1..f0de0e141cc59 100644 --- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -161,7 +161,7 @@ bool CoreEngine::ExecuteWorkList(const StackFrame *SF, unsigned MaxSteps, return MaxSteps - Steps; }; const unsigned STUSteps = ProcessWList(MaxSteps); - exploredAllSTUPaths = WList->hasWork(); + notExploredAllSTUPaths = WList->hasWork(); if (CTUWList) { NumSTUSteps += STUSteps; >From b917316e2844c8149a9d55e90368455dc8fc14b3 Mon Sep 17 00:00:00 2001 From: Marco Milanese <[email protected]> Date: Wed, 2 Sep 2026 18:00:33 +0200 Subject: [PATCH 2/2] format --- .../clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index 2e891cae75f1c..f3a2abe86bc64 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -467,7 +467,9 @@ class ExprEngine { // Functions for external checking of whether we have unfinished work. bool wasBlocksExhausted() const { return Engine.wasBlocksExhausted(); } bool hasEmptyWorkList() const { return !Engine.getWorkList()->hasWork(); } - bool hasNotExploredAllPaths() const { return Engine.hasNotExploredAllPaths(); } + bool hasNotExploredAllPaths() const { + return Engine.hasNotExploredAllPaths(); + } const CoreEngine &getCoreEngine() const { return Engine; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
