[all-commits] [llvm/llvm-project] 2bd098: [analyzer] Trigger checkLifetimeEnd callback from ...

Arseniy Zaostrovnykh via All-commits all-commits at lists.llvm.org
Mon Jun 8 03:22:26 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2bd098b819c19ccca082ebdc7042211bd68cb3b1
      https://github.com/llvm/llvm-project/commit/2bd098b819c19ccca082ebdc7042211bd68cb3b1
  Author: Arseniy Zaostrovnykh <necto.ne at gmail.com>
  Date:   2026-06-08 (Mon, 08 Jun 2026)

  Changed paths:
    M clang/include/clang/Analysis/CFG.h
    M clang/include/clang/Analysis/ProgramPoint.h
    M clang/include/clang/StaticAnalyzer/Core/Checker.h
    M clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    M clang/lib/Analysis/PathDiagnostic.cpp
    M clang/lib/Analysis/ProgramPoint.cpp
    M clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
    M clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
    M clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    A clang/test/Analysis/lifetime-end-simple-cfg-output.cpp
    M clang/unittests/StaticAnalyzer/CMakeLists.txt
    A clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp
    M clang/unittests/StaticAnalyzer/CheckerRegistration.h

  Log Message:
  -----------
  [analyzer] Trigger checkLifetimeEnd callback from CFGLifetimeEnds element

This patch adds handling of the `CFGLifetimeEnd` element to the CSA, and
produces a newly created callback `checkLifetimeEnd` for each occurrence
of it.

It is useful to implement detection of dangling pointers as in:

```
void su_use_after_block ()  { int* p=0; { int x=1; p=&x; } *p = 2; }
//                                                       ^ p dangles
```

This patch does not implement the check itself. it is motivated by the
discussion in

https://discourse.llvm.org/t/what-is-the-status-of-scopeend-and-scopebegin/90861

--
upstreamed part of CPP-4539

---------

Co-authored-by: tomasz-kaminski-sonarsource <tomasz.kaminski at sonarsource.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list