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

Donát Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 07:03:18 PDT 2026


================
@@ -806,6 +806,11 @@ def UseAfterLifetimeEnd : Checker<"UseAfterLifetimeEnd">,
   Dependencies<[LifetimeModeling]>,
   Documentation<NotDocumented>;
 
+def ReportDanglingPtrDeref : Checker<"ReportDanglingPtrDeref">,
+  HelpText<"Check for dereferences of a dangling pointer">,
+  Dependencies<[LifetimeModeling]>,
+  Documentation<NotDocumented>;
----------------
NagyDonat wrote:

> I think we are better off to wait a couple of weeks with the documentation and naming things for now.

Ok, feel free to do so, it is completely reasonable to avoid the churn. I didn't know that you have concrete plans that would significantly change the scope. 

I trust you that you will add documentation when you finish (or abandon) the active development.

> > They may crash or emit a higher number of false positives.
> 
> In practical terms, the bar is really really low. It shouldn't get in the way of regular users. Like if even crashing is allowed, I don't think documentation should be a blocker or expected. Consequently, blocking PRs for alphas needs some serious concerns.

I read this as "it is acceptable if the alpha checker crashes on _some particular corner cases_" (or has other known bugs); I would still reject a proposed alpha checker if it crashed on _almost all_ uses of the relevant language feature. (That is just unfinished code, and doesn't belong to the main branch IMO.)

Analogously, I think it is OK if the documentation of an alpha checker is short or not entirely accurate, but I would prefer to require at least a placeholder. However, I don't mind if code under active development temporarily violates this – I just want to avoid leaving checkers without docs for several years.

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


More information about the cfe-commits mailing list