https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/218937
From 7152d4b8458978690af577ffa258d32015caf807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <[email protected]> Date: Wed, 26 Aug 2026 15:49:45 +0200 Subject: [PATCH 1/2] [NFC][analyzer] Remove non-const CheckerContext::isDifferent The method `CheckerContext::isDifferent` should be a `const` method (it does not modify `*this`), but it was originally declared as non-`const` and later commit f93f6e5259e32a00921c66561f3117356a779a01 introduced the `const` variant as an overload along the non-`const` original variant. As the non-`const` overload is does not have any advantage, this commit removes it. (In many other cases a separate non-`const` overload is needed because the `const` overload has `const` in its return type, but here both overloads return the same `bool`.) --- .../clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 38bcd55354a63..1262dbea88715 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -83,7 +83,6 @@ class CheckerContext { /// Check if the checker changed the state of the execution; ex: added /// a new transition or a bug report. - bool isDifferent() { return Changed; } bool isDifferent() const { return Changed; } /// Returns the number of times the current block has been visited From dc2e813f20e1134cb4c84e82e0cae7b5edf84204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <[email protected]> Date: Wed, 26 Aug 2026 16:47:25 +0200 Subject: [PATCH 2/2] Unify overloads of CheckerContext::getPredecessor() We can return a pointer to a non-const `ExplodedNode` even if `*this` is const. (Note that `ExplodedNode`s are almost always non-const because `addPredecessor()` is a non-`const` method). --- .../clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 1262dbea88715..6463bad3de6ab 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -76,8 +76,7 @@ class CheckerContext { /// Returns the previous node in the exploded graph, which includes /// the state of the program before the checker ran. Note, checkers should /// not retain the node in their state since the nodes might get invalidated. - ExplodedNode *getPredecessor() { return Pred; } - const ExplodedNode *getPredecessor() const { return Pred; } + ExplodedNode *getPredecessor() const { return Pred; } const ProgramPoint getLocation() const { return Location; } const ProgramStateRef &getState() const { return Pred->getState(); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
