Implementing the C++ Core Guidelines’ Lifetime Safety Profile in Clang
summary
Clang-based checker implements Herb Sutter’s Lifetime Safety Profile using Clang AST/type trees and control-flow graphs and flags use-after-invalidation and null-dereference for pointers, iterators and string_view; it models P-sets and P-maps and propagates null info through CFG branches. Implementation is alpha (about eight weeks of recent work), runs on real LLVM translation units with measured overhead <5% compile-time when building objects, and exposes code at github.com/mgehre/clang and cppx.godbolt.org. Missing or incomplete: aggregate expansion, use-after-move, explicit annotations and some lambda/escape cases; heuristics drive inter-function lifetime derivation.
AI-written summary · about
chapters (14)
- 0:00Introduction to lifetime safety
- 3:58Paper and implementation overview
- 5:27Intra-function analysis examples
- 9:49Type classification in analysis
- 12:43P-sets and P-maps explained
- 17:43Control flow and merging P-sets
- 18:48Null tracking in analysis
- 20:17Inter-function analysis challenges
- 23:55Lifetime annotations and heuristics
- 34:14Deriving pointers from arguments
- 37:07Current performance and status
- 40:39Reddit examples and limitations
- 47:24Feedback and future plans
- 1:01:37Q&A session
related talks
59mLifetime analysis for everyone
01h 26mA Path to Practically Safe C++
01h 03mLifetime Safety in C++: Past, Present and Future
01h 12mFinding Bugs with Clang at Compile and Run Time
54mType-and-resource Safety in Modern C++
58mAn (In-)Complete Guide to C++ Object Lifetimes
01h 28mKeynote: Safety, Security, Safety and C / C++ - C++ Evolution
01h 05mSecurity in C++: Hardening techniques from the trenches
