llvm-project
34f5b807 - [LifetimeSafety] Track origins for lifetimebound calls returning record types (#187917)

Commit
52 days ago
[LifetimeSafety] Track origins for lifetimebound calls returning record types (#187917) - Move `hasOrigins` from free function to `OriginManager` method - Add pre-scan (`collectLifetimeboundOriginTypes`) to register return types of `[[clang::lifetimebound]]` calls before fact generation - Generalize copy/move constructor origin propagation from lambda-only to all types with `isDefaulted()` and `hasOrigins()` guard - `isDefaulted()` is a heuristic: it avoids false positives from user-defined copies with opaque semantics, but can still false-positive when a defaulted outer copy invokes a user-defined inner copy that breaks the propagate chain. See `nested_defaulted_outer_with_user_defined_inner` - Guard `operator=` origin propagation: pointer-like types always propagate; other tracked types only when defaulted - Defer `ThisOrigins` construction until after the pre-scan to avoid origin list depth mismatch - Fix `IsArgLifetimeBound` to exclude constructors from the instance-method branch (latent bug exposed by this change) Limitations (documented with FIXME tests): - User-defined copy/move that shallow-copies: false negative - Defaulted outer copy invoking user-defined inner copy: false positive - Non-pointer/ref/gsl::Pointer parameter types with `[[clang::lifetimebound]]`: not registered Fixes #163600
Author
Parents
Loading