[clang] [analyzer] Implement LifetimeAnnotations checker (PR #205521)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 05:36:35 PDT 2026


================
@@ -0,0 +1,171 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.LifetimeAnnotations,debug.DebugLifetimeAnnotations \
+// RUN:   -analyzer-config cfg-lifetime=true -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.LifetimeAnnotations,debug.DebugLifetimeAnnotations \
+// RUN:   -analyzer-config c++-container-inlining=false -analyzer-config cfg-lifetime=true -verify %s
+
+struct A {};
+
+void clang_analyzer_lifetime_bound(int*);
+void clang_analyzer_lifetime_bound(int&);
+void clang_analyzer_lifetime_bound(A*);
+void clang_analyzer_lifetime_bound(A&);
+
+// These are the cases when the result of function calls are MemRegions.
+
+// Ref type parameter annotated case
----------------
steakhal wrote:

Comments are usually punctuated even in tests. More in this file.

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


More information about the cfe-commits mailing list