[clang] [LifetimeSafety] Support allocating/freeing functions annotated `ownership_takes`/`ownership_returns` (PR #213439)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 6 05:47:09 PST 2026
================
@@ -159,8 +165,10 @@ class AccessPath {
return dyn_cast<const PlaceholderBase *>(Base);
}
- const clang::CXXNewExpr *getAsNewAllocation() const {
- return dyn_cast<const clang::CXXNewExpr *>(Base);
+ /// Returns the allocation expression that created this loan: a
+ /// `CXXNewExpr` or an allocating call.
+ const clang::Expr *getAsAllocation() const {
+ return dyn_cast<const clang::Expr *>(Base);
}
----------------
NeKon69 wrote:
Yeah, I thought it would make sense to make the returned value a bit more ambiguous rather than having to deal with a union on every call site. If you have a strong feeling about this, let me know.
https://github.com/llvm/llvm-project/pull/213439
More information about the cfe-commits
mailing list