[llvm-branch-commits] [clang] [llvm] [analyzer] Rename DanglingPtrDeref to StackUseAfterScope and move it to core (PR #233889)
Benedek Kaibas via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 29 04:55:08 PDT 2026
https://github.com/benedekaibas updated https://github.com/llvm/llvm-project/pull/233889
>From 99faae5d3745f04e5e4f5b80cc83d1391d7d34d6 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Tue, 20 Oct 2026 17:43:31 +0200
Subject: [PATCH 1/6] [analyzer] Rename DanglingPtrDeref to StackUseAfterScope
and move it to core
---
clang/docs/analyzer/checkers.md | 112 +++++++++---------
.../clang/StaticAnalyzer/Checkers/Checkers.td | 20 ++--
.../StaticAnalyzer/Checkers/CMakeLists.txt | 2 +-
...ingPtrDeref.cpp => StackUseAfterScope.cpp} | 28 ++---
.../test/Analysis/analyzer-enabled-checkers.c | 2 +
.../test/Analysis/lifetime-end-path-notes.cpp | 2 +-
...tr-deref.cpp => stack-use-after-scope.cpp} | 2 +-
...c-library-functions-arg-enabled-checkers.c | 2 +
clang/test/Analysis/use-after-move.cpp | 3 +-
9 files changed, 88 insertions(+), 85 deletions(-)
rename clang/lib/StaticAnalyzer/Checkers/{DanglingPtrDeref.cpp => StackUseAfterScope.cpp} (79%)
rename clang/test/Analysis/{dangling-ptr-deref.cpp => stack-use-after-scope.cpp} (99%)
diff --git a/clang/docs/analyzer/checkers.md b/clang/docs/analyzer/checkers.md
index 5e9bda7e46a279..e9f4e2cb118c5a 100644
--- a/clang/docs/analyzer/checkers.md
+++ b/clang/docs/analyzer/checkers.md
@@ -327,6 +327,62 @@ void taintedVerfieidVLA(void) {
}
```
+(core-StackUseAfterScope)=
+
+#### core.StackUseAfterScope (C, C++)
+
+Check for dereferences of pointers that refer to an object whose
+lifetime has already ended. Such a pointer is dangling. The checker
+reports it when it is dereferenced and when it is passed to a function.
+A return statement that does not dereference the pointer does not lead to a report.
+Such a case is reported by the {ref}`core-StackAddressEscape` checker.
+
+Each object is reported at most once on an execution path. If the same dangling
+pointer is used several times then only the first use is reported. Setting the pointer
+to null when the object goes out of scope avoids the dangling pointer and suppresses
+the report.
+
+```cpp
+void test_deref() {
+ int *ptr = 0;
+ {
+ int num = 5;
+ ptr = #
+ } // note: 'num' is destroyed here
+ *ptr = 6; // warn: use of 'num' after its lifetime ended
+}
+
+void test_in_scope() {
+ int num = 5;
+ int *ptr = #
+ {
+ *ptr = 6; // no warning, 'num' is still in scope
+ }
+}
+```
+
+**Limitations**
+
+If the analyzer cannot analyze the body of the called function, for example because
+its definition is not available in the given translation unit, then a dangling
+pointer passed to it is reported even if the function would never dereference
+it. This can lead to false positives.
+
+```cpp
+// The definition of the function is not available that is why the analyzer
+// assumes the pointer is used.
+int is_null(int *p);
+
+void argument_example() {
+ int *ptr = 0;
+ {
+ int num = 5;
+ ptr = #
+ }
+ is_null(ptr); // false positive: the pointer is compared, not dereferenced
+}
+```
+
(core-uninitialized-arraysubscript)=
#### core.uninitialized.ArraySubscript (C)
@@ -3195,62 +3251,6 @@ void test() {
}
```
-(alpha-core-danglingptrderef)=
-
-#### alpha.core.DanglingPtrDeref (C, C++)
-
-Check for dereferences of pointers that refer to an object whose
-lifetime has already ended. Such a pointer is dangling. The checker
-reports it when it is dereferenced and when it is passed to a function.
-A return statement that does not dereference the pointer does not lead to a report.
-Such a case is reported by the {ref}`core-StackAddressEscape` checker.
-
-Each object is reported at most once on an execution path. If the same dangling
-pointer is used several times then only the first use is reported. Setting the pointer
-to null when the object goes out of scope avoids the dangling pointer and suppresses
-the report.
-
-```cpp
-void test_deref() {
- int *ptr = 0;
- {
- int num = 5;
- ptr = #
- } // note: 'num' is destroyed here
- *ptr = 6; // warn: use of 'num' after its lifetime ended
-}
-
-void test_in_scope() {
- int num = 5;
- int *ptr = #
- {
- *ptr = 6; // no warning, 'num' is still in scope
- }
-}
-```
-
-**Limitations**
-
-If the analyzer cannot analyze the body of the called function, for example because
-its definition is not available in the given translation unit, then a dangling
-pointer passed to it is reported even if the function would never dereference
-it. This can lead to false positives.
-
-```cpp
-// The definition of the function is not available that is why the analyzer
-// assumes the pointer is used.
-int is_null(int *p);
-
-void argument_example() {
- int *ptr = 0;
- {
- int num = 5;
- ptr = #
- }
- is_null(ptr); // false positive: the pointer is compared, not dereferenced
-}
-```
-
(alpha-core-dynamictypechecker)=
#### alpha.core.DynamicTypeChecker (ObjC)
diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
index a3963dad3b3822..5b47bd79f85c97 100644
--- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -231,6 +231,16 @@ def NonnullGlobalConstantsChecker: Checker<"NonnilStringConstants">,
Documentation<NotDocumented>,
Hidden;
+def LifetimeModeling : Checker<"LifetimeModeling">,
+ HelpText<"Model lifetime annotations for other checkers">,
+ Documentation<NotDocumented>,
+ Hidden;
+
+def StackUseAfterScope : Checker<"StackUseAfterScope">,
+ HelpText<"Check for uses of stack objects after their scope has ended">,
+ Dependencies<[LifetimeModeling]>,
+ Documentation<HasDocumentation>;
+
} // end "core"
let ParentPackage = CoreAlpha in {
@@ -289,22 +299,12 @@ def StdVariantChecker : Checker<"StdVariant">,
HelpText<"Check for bad type access for std::variant.">,
Documentation<HasDocumentation>;
-def LifetimeModeling : Checker<"LifetimeModeling">,
- HelpText<"Model lifetime annotations for other checkers">,
- Documentation<NotDocumented>,
- Hidden;
-
def UseAfterLifetimeEnd : Checker<"UseAfterLifetimeEnd">,
HelpText<"Check for uses of references or pointers that "
"outlive their bound object">,
Dependencies<[LifetimeModeling]>,
Documentation<HasDocumentation>;
-def DanglingPtrDeref : Checker<"DanglingPtrDeref">,
- HelpText<"Check for dereferences of a dangling pointer">,
- Dependencies<[LifetimeModeling]>,
- Documentation<HasDocumentation>;
-
} // end "alpha.core"
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
index f136bd5434113b..8868a4b182ad7f 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -31,7 +31,6 @@ add_clang_library(clangStaticAnalyzerCheckers
ConversionChecker.cpp
CXXDeleteChecker.cpp
CXXSelfAssignmentChecker.cpp
- DanglingPtrDeref.cpp
DeadStoresChecker.cpp
DebugCheckers.cpp
DebugContainerModeling.cpp
@@ -106,6 +105,7 @@ add_clang_library(clangStaticAnalyzerCheckers
SmartPtrChecker.cpp
SmartPtrModeling.cpp
StackAddrEscapeChecker.cpp
+ StackUseAfterScope.cpp
StoreToImmutableChecker.cpp
StdLibraryFunctionsChecker.cpp
StdVariantChecker.cpp
diff --git a/clang/lib/StaticAnalyzer/Checkers/DanglingPtrDeref.cpp b/clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp
similarity index 79%
rename from clang/lib/StaticAnalyzer/Checkers/DanglingPtrDeref.cpp
rename to clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp
index cd690328ebc474..4ae9ab40de52d2 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DanglingPtrDeref.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp
@@ -10,21 +10,21 @@ using namespace clang;
using namespace ento;
namespace {
-class DanglingPtrDeref : public Checker<check::Location, check::PostCall> {
+class StackUseAfterScope : public Checker<check::Location, check::PostCall> {
public:
void checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
CheckerContext &C) const;
void checkPostCall(const CallEvent &Call, CheckerContext &C) const;
void reportUseAfterScope(const MemRegion *Region, const Stmt *S,
ExplodedNode *N, CheckerContext &C) const;
- const BugType BugMsg{this, "ReportDanglingPtrDeref", "LifetimeBound"};
+ const BugType BugMsg{this, "StackUseAfterScope", "LifetimeBound"};
};
-class DanglingPtrDerefBRVisitor : public BugReporterVisitor {
+class StackUseAfterScopeBRVisitor : public BugReporterVisitor {
const MemRegion *SourceRegion;
public:
- explicit DanglingPtrDerefBRVisitor(const MemRegion *Source)
+ explicit StackUseAfterScopeBRVisitor(const MemRegion *Source)
: SourceRegion(Source) {}
void Profile(llvm::FoldingSetNodeID &ID) const override {
@@ -38,7 +38,7 @@ class DanglingPtrDerefBRVisitor : public BugReporterVisitor {
} // namespace
-void DanglingPtrDeref::checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
+void StackUseAfterScope::checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
CheckerContext &C) const {
ProgramStateRef State = C.getState();
@@ -50,7 +50,7 @@ void DanglingPtrDeref::checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
}
}
-void DanglingPtrDeref::checkPostCall(const CallEvent &Call,
+void StackUseAfterScope::checkPostCall(const CallEvent &Call,
CheckerContext &C) const {
ProgramStateRef State = C.getState();
// Only check calls arguments if it is not inlined by the engine. In case a
@@ -66,7 +66,7 @@ void DanglingPtrDeref::checkPostCall(const CallEvent &Call,
}
}
-void DanglingPtrDeref::reportUseAfterScope(const MemRegion *Region,
+void StackUseAfterScope::reportUseAfterScope(const MemRegion *Region,
const Stmt *S, ExplodedNode *N,
CheckerContext &C) const {
ProgramStateRef ReportedState =
@@ -79,7 +79,7 @@ void DanglingPtrDeref::reportUseAfterScope(const MemRegion *Region,
(llvm::Twine("Use of ") + lifetime_modeling::getRegionName(Region) +
" after its lifetime ended."),
N);
- BR->addVisitor<DanglingPtrDerefBRVisitor>(Region);
+ BR->addVisitor<StackUseAfterScopeBRVisitor>(Region);
if (S) {
if (const Expr *DerefExpr = bugreporter::getDerefExpr(S))
bugreporter::trackExpressionValue(N, DerefExpr, *BR);
@@ -89,9 +89,9 @@ void DanglingPtrDeref::reportUseAfterScope(const MemRegion *Region,
}
PathDiagnosticPieceRef
-DanglingPtrDerefBRVisitor::VisitNode(const ExplodedNode *N,
- BugReporterContext &BRC,
- PathSensitiveBugReport &BR) {
+StackUseAfterScopeBRVisitor::VisitNode(const ExplodedNode *N,
+ BugReporterContext &BRC,
+ PathSensitiveBugReport &BR) {
using lifetime_modeling::isDeallocated;
const ExplodedNode *Pred = N->getFirstPred();
if (!Pred)
@@ -115,10 +115,10 @@ DanglingPtrDerefBRVisitor::VisitNode(const ExplodedNode *N,
true);
}
-void ento::registerDanglingPtrDeref(CheckerManager &Mgr) {
- Mgr.registerChecker<DanglingPtrDeref>();
+void ento::registerStackUseAfterScope(CheckerManager &Mgr) {
+ Mgr.registerChecker<StackUseAfterScope>();
}
-bool ento::shouldRegisterDanglingPtrDeref(const CheckerManager &Mgr) {
+bool ento::shouldRegisterStackUseAfterScope(const CheckerManager &Mgr) {
return true;
}
diff --git a/clang/test/Analysis/analyzer-enabled-checkers.c b/clang/test/Analysis/analyzer-enabled-checkers.c
index 8371b0e7a410a8..dd84a86fffe25c 100644
--- a/clang/test/Analysis/analyzer-enabled-checkers.c
+++ b/clang/test/Analysis/analyzer-enabled-checkers.c
@@ -15,11 +15,13 @@
// CHECK-NEXT: core.CallAndMessage
// CHECK-NEXT: core.DivideZero
// CHECK-NEXT: core.DynamicTypePropagation
+// CHECK-NEXT: core.LifetimeModeling
// CHECK-NEXT: core.NonNullParamChecker
// CHECK-NEXT: core.NonnilStringConstants
// CHECK-NEXT: core.NullDereference
// CHECK-NEXT: core.NullPointerArithm
// CHECK-NEXT: core.StackAddressEscape
+// CHECK-NEXT: core.StackUseAfterScope
// CHECK-NEXT: core.UndefinedBinaryOperatorResult
// CHECK-NEXT: core.VLASize
// CHECK-NEXT: core.builtin.AssumeModeling
diff --git a/clang/test/Analysis/lifetime-end-path-notes.cpp b/clang/test/Analysis/lifetime-end-path-notes.cpp
index 9fba6b7f845307..8c909dd00d86ed 100644
--- a/clang/test/Analysis/lifetime-end-path-notes.cpp
+++ b/clang/test/Analysis/lifetime-end-path-notes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection,alpha.core.DanglingPtrDeref -analyzer-config cfg-lifetime=true -analyzer-output=text -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection,core.StackUseAfterScope -analyzer-config cfg-lifetime=true -analyzer-output=text -verify %s
void clang_analyzer_warnIfReached();
diff --git a/clang/test/Analysis/dangling-ptr-deref.cpp b/clang/test/Analysis/stack-use-after-scope.cpp
similarity index 99%
rename from clang/test/Analysis/dangling-ptr-deref.cpp
rename to clang/test/Analysis/stack-use-after-scope.cpp
index 8572b6416f150f..0f0cb1c3e751a4 100644
--- a/clang/test/Analysis/dangling-ptr-deref.cpp
+++ b/clang/test/Analysis/stack-use-after-scope.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.DanglingPtrDeref \
+// RUN: %clang_analyze_cc1 -analyzer-checker=core.StackUseAfterScope \
// RUN: -analyzer-config cfg-lifetime=true -analyzer-output=text -verify %s
void test_case_one() {
diff --git a/clang/test/Analysis/std-c-library-functions-arg-enabled-checkers.c b/clang/test/Analysis/std-c-library-functions-arg-enabled-checkers.c
index e1f365cdfbcf63..13455fd1a2bbdc 100644
--- a/clang/test/Analysis/std-c-library-functions-arg-enabled-checkers.c
+++ b/clang/test/Analysis/std-c-library-functions-arg-enabled-checkers.c
@@ -23,11 +23,13 @@
// CHECK-NEXT: core.CallAndMessage
// CHECK-NEXT: core.DivideZero
// CHECK-NEXT: core.DynamicTypePropagation
+// CHECK-NEXT: core.LifetimeModeling
// CHECK-NEXT: core.NonNullParamChecker
// CHECK-NEXT: core.NonnilStringConstants
// CHECK-NEXT: core.NullDereference
// CHECK-NEXT: core.NullPointerArithm
// CHECK-NEXT: core.StackAddressEscape
+// CHECK-NEXT: core.StackUseAfterScope
// CHECK-NEXT: core.UndefinedBinaryOperatorResult
// CHECK-NEXT: core.VLASize
// CHECK-NEXT: core.builtin.AssumeModeling
diff --git a/clang/test/Analysis/use-after-move.cpp b/clang/test/Analysis/use-after-move.cpp
index fa7893c9a21c8b..a2e5de8e65afd9 100644
--- a/clang/test/Analysis/use-after-move.cpp
+++ b/clang/test/Analysis/use-after-move.cpp
@@ -159,12 +159,11 @@ void simpleMoveCtorTest() {
clang_analyzer_printState();
// CHECK: "checker_messages": [
-// CHECK-NEXT: { "checker": "cplusplus.Move", "messages": [
+// CHECK: { "checker": "cplusplus.Move", "messages": [
// CHECK-NEXT: "Moved-from objects :",
// CHECK: "a: moved",
// CHECK: ""
// CHECK-NEXT: ]}
-// CHECK-NEXT: ]
#endif
a.foo(); // peaceful-warning {{Method called on moved-from object 'a'}}
>From 8841eb9994c978370c8f11ced0fd784ae4d04bc6 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Tue, 20 Oct 2026 19:17:56 +0200
Subject: [PATCH 2/6] Remove capital letters and the old checker name.
---
clang/docs/analyzer/checkers.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/docs/analyzer/checkers.md b/clang/docs/analyzer/checkers.md
index e9f4e2cb118c5a..19aa727c3e9a46 100644
--- a/clang/docs/analyzer/checkers.md
+++ b/clang/docs/analyzer/checkers.md
@@ -327,7 +327,7 @@ void taintedVerfieidVLA(void) {
}
```
-(core-StackUseAfterScope)=
+(core-stackuseafterscope)=
#### core.StackUseAfterScope (C, C++)
@@ -335,7 +335,7 @@ Check for dereferences of pointers that refer to an object whose
lifetime has already ended. Such a pointer is dangling. The checker
reports it when it is dereferenced and when it is passed to a function.
A return statement that does not dereference the pointer does not lead to a report.
-Such a case is reported by the {ref}`core-StackAddressEscape` checker.
+Such a case is reported by the {ref}`core-stackaddressescape` checker.
Each object is reported at most once on an execution path. If the same dangling
pointer is used several times then only the first use is reported. Setting the pointer
@@ -3374,7 +3374,7 @@ int &method_return() {
directly. This checker extends that detection through functions that are
annotated with `[[clang::lifetimebound]]`.
-{ref}`alpha-core-danglingptrderef` reports use-after-scope errors anywhere in
+{ref}`core-stackuseafterscope` reports use-after-scope errors anywhere in
the function and does not rely on annotations. This checker reports the value
that is returned from the function.
>From 5d6ea1acd6da1548776ef26584585e9a9794bb74 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Tue, 27 Oct 2026 19:24:13 +0100
Subject: [PATCH 3/6] Update the checker name correctly in the test file.
---
clang/test/Analysis/checker-order-in-dump.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/Analysis/checker-order-in-dump.cpp b/clang/test/Analysis/checker-order-in-dump.cpp
index 49c3c694b95c18..14eec19e185f20 100644
--- a/clang/test/Analysis/checker-order-in-dump.cpp
+++ b/clang/test/Analysis/checker-order-in-dump.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.Move \
-// RUN: -analyzer-checker=alpha.core.LifetimeModeling,debug.ExprInspection \
+// RUN: -analyzer-checker=core.LifetimeModeling,debug.ExprInspection \
// RUN: -analyzer-config cfg-lifetime=true \
// RUN: -verify %s 2>&1 | FileCheck %s
@@ -24,7 +24,7 @@ void testCheckersOrderInStateDump() {
clang_analyzer_printState();
(void)p;
// CHECK: "checker_messages": [
-// CHECK-NEXT: { "checker": "alpha.core.LifetimeModeling", "messages": [
+// CHECK-NEXT: { "checker": "core.LifetimeModeling", "messages": [
// CHECK-NEXT: "LifetimeBound bindings:",
// CHECK-NEXT: " Origin &a contains Loan a",
// CHECK-NEXT: ""
>From ed2ba7defb85c4a04092f708dcc241890328fb22 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Tue, 27 Oct 2026 19:47:43 +0100
Subject: [PATCH 4/6] Run clang-format on StackUseAfterScope.
---
clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp b/clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp
index 4ae9ab40de52d2..42009113e45305 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackUseAfterScope.cpp
@@ -39,7 +39,7 @@ class StackUseAfterScopeBRVisitor : public BugReporterVisitor {
} // namespace
void StackUseAfterScope::checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
- CheckerContext &C) const {
+ CheckerContext &C) const {
ProgramStateRef State = C.getState();
if (const MemRegion *LocRegion = Loc.getAsRegion()) {
@@ -51,7 +51,7 @@ void StackUseAfterScope::checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
}
void StackUseAfterScope::checkPostCall(const CallEvent &Call,
- CheckerContext &C) const {
+ CheckerContext &C) const {
ProgramStateRef State = C.getState();
// Only check calls arguments if it is not inlined by the engine. In case a
// function is inlined checkLocation handles any dereference in its body.
@@ -67,8 +67,8 @@ void StackUseAfterScope::checkPostCall(const CallEvent &Call,
}
void StackUseAfterScope::reportUseAfterScope(const MemRegion *Region,
- const Stmt *S, ExplodedNode *N,
- CheckerContext &C) const {
+ const Stmt *S, ExplodedNode *N,
+ CheckerContext &C) const {
ProgramStateRef ReportedState =
lifetime_modeling::markAsReported(N->getState(), Region);
if (!ReportedState)
>From 004be2f41a3f77fab0d22961446d1079ae187a4d Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Tue, 27 Oct 2026 23:42:37 +0100
Subject: [PATCH 5/6] Update Build.gn.
---
.../gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
index f048acd18d904e..cd29ad50825013 100644
--- a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
@@ -40,7 +40,6 @@ static_library("Checkers") {
"CloneChecker.cpp",
"ContainerModeling.cpp",
"ConversionChecker.cpp",
- "DanglingPtrDeref.cpp",
"DeadStoresChecker.cpp",
"DebugCheckers.cpp",
"DebugContainerModeling.cpp",
@@ -115,6 +114,7 @@ static_library("Checkers") {
"SmartPtrChecker.cpp",
"SmartPtrModeling.cpp",
"StackAddrEscapeChecker.cpp",
+ "StackUseAfterScope.cpp",
"StdLibraryFunctionsChecker.cpp",
"StdVariantChecker.cpp",
"StoreToImmutableChecker.cpp",
>From 88bc9de92706ed87979cbcd89e70003c0ae56b86 Mon Sep 17 00:00:00 2001
From: benedekaibas <kaibas01 at allegheny.edu>
Date: Thu, 29 Oct 2026 12:54:31 +0100
Subject: [PATCH 6/6] Anchor on PostStore instead of matching the first Store.
---
clang/test/Analysis/exploded-graph-rewriter/escapes.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/test/Analysis/exploded-graph-rewriter/escapes.c b/clang/test/Analysis/exploded-graph-rewriter/escapes.c
index a3a6868cf8dfab..1d205673b1ab59 100644
--- a/clang/test/Analysis/exploded-graph-rewriter/escapes.c
+++ b/clang/test/Analysis/exploded-graph-rewriter/escapes.c
@@ -4,10 +4,11 @@
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
void escapes(void) {
- // CHECK: <td align="left"><b>Store: </b> <font color="gray">(0x{{[0-9a-f]*}})</font></td>
+ // CHECK: <font color="cyan3">PostStore</font></td><td align="left">const char *const foo = "foo";</td>
+ // CHECK-SAME: <td align="left"><b>Store: </b> <font color="gray">(0x{{[0-9a-f]*}})</font></td>
// CHECK-SAME: <td align="left">foo</td><td align="left">0</td>
// CHECK-SAME: <td align="left">&Element\{"foo",0 S64b,char\}</td>
- // CHECK: <td align="left"><b>Expressions: </b></td>
+ // CHECK-SAME: <td align="left"><b>Expressions: </b></td>
// CHECK-SAME: <td align="left">"foo"</td>
// CHECK-SAME: <td align="left">&Element\{"foo",0 S64b,char\}</td>
const char *const foo = "\x66\x6f\x6f";
More information about the llvm-branch-commits
mailing list