[clang] [clang][docs] Add documentation for the DanglingPtrDeref checker (PR #216688)

Benedek Kaibas via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 05:48:46 PDT 2026


================
@@ -3351,6 +3351,62 @@ remove the const qualifier from the original declaration or use a mutable copy.
 alpha.cplusplus
 ^^^^^^^^^^^^^^^
 
+.. _alpha-cplusplus-DanglingPtrDeref:
+
+alpha.cplusplus.DanglingPtrDeref (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.
----------------
benedekaibas wrote:

Yes, and it is important to be mentioned. Also I have added an explanation on in which scenario does the checker report for a return statement (dereferencing happens in the statement) and which scenario it does not (there is no dereference) and which checker's job is that. Applied changes here: [4f0d299](https://github.com/llvm/llvm-project/pull/216688/commits/4f0d29983a2af8b32c565ed87771c895d725e95f)

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


More information about the cfe-commits mailing list