[clang] [LifetimeSafety] Track origins for lifetimebound calls returning record types (PR #187917)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 03:59:55 PDT 2026


================
@@ -155,11 +158,20 @@ class OriginManager {
 
   unsigned getNumOrigins() const { return NextOriginID.Value; }
 
+  bool hasOrigins(QualType QT) const;
+  bool hasOrigins(const Expr *E) const;
+
   void dump(OriginID OID, llvm::raw_ostream &OS) const;
 
   /// Collects statistics about expressions that lack associated origins.
   void collectMissingOrigins(Stmt &FunctionBody, LifetimeSafetyStats &LSStats);
 
+  /// Pre-scans the function body (and constructor init lists) to discover
+  /// return types of [[clang::lifetimebound]] calls, registering them for
+  /// origin tracking.
+  void collectLifetimeboundOriginTypes(AnalysisDeclContext &AC);
----------------
Xazax-hun wrote:

I am not sure if any of these including `initializeThisOrigins` should be part of the public interface. We cannot correctly generate facts without these being used at the right time. I wonder if the ctor should just take care of everything and we should make these private.

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


More information about the cfe-commits mailing list