================ @@ -216,6 +216,59 @@ void Sema::inferGslOwnerPointerAttribute(CXXRecordDecl *Record) { inferGslPointerAttribute(Record, Record); } +void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) { + if (FD->getNumParams() == 0) + return; + + if (unsigned BuiltinID = FD->getBuiltinID()) { + // Add lifetime attribute to std::move, std::fowrard et al. + switch (BuiltinID) { + case Builtin::BIaddressof: + case Builtin::BI__addressof: + case Builtin::BI__builtin_addressof: + case Builtin::BIas_const: ---------------- hokein wrote:
(The latter two cases are identical, we could potentially abstract a common function.) I think this should be handled on a case-by-case basis, depending on the specific logic involved. It seems fine to me have this small amount of duplication. https://github.com/llvm/llvm-project/pull/103716 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits