[clang] [LifetimeSafety] Add support for tracking temporary objects (PR #172007)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 12 06:29:48 PST 2025


================
@@ -29,9 +30,25 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, LoanID ID) {
 /// variable.
 /// TODO: Model access paths of other types, e.g., s.field, heap and globals.
 struct AccessPath {
-  const clang::ValueDecl *D;
+  // Currently, an access path can be:
+  // - ValueDecl * , to represent the storage location corresponding to the
+  //   variable declared in ValueDecl.
+  // - CXXBindTemporaryExpr * , to represent the storage location of the
----------------
Xazax-hun wrote:

I wonder if it is better to store the `MaterializeTemporaryExpr` as we do not have `CXXBindTemporaryExpr`s for trivial types and `MaterializeTemporaryExpr` is the point when we actually start to have a memory address for the value. 

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


More information about the cfe-commits mailing list