[clang] [analyzer] Implemented the DanglingPtrDeref checker to detect use-after-scope lifetime errors (PR #209278)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 02:30:51 PDT 2026


================
@@ -0,0 +1,86 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.ReportDanglingPtrDeref \
+// RUN:   -analyzer-config cfg-lifetime=true -analyzer-output=text -verify %s
+
+void test_case_one() {
+  int *ptr = nullptr;
+  // expected-note at +1 {{'num' is destroyed here}}
----------------
Xazax-hun wrote:

These notes seem to be at the wrong place?

https://github.com/llvm/llvm-project/pull/209278


More information about the cfe-commits mailing list