================ @@ -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: ---------------- Xazax-hun wrote:
I start to have the feeling we are writing code like this over and over again. Some examples: https://github.com/llvm/llvm-project/blob/df57833ea8a3f527b7941576b4a130ddd4361e61/clang/lib/Analysis/BodyFarm.cpp#L718 https://github.com/llvm/llvm-project/blob/df57833ea8a3f527b7941576b4a130ddd4361e61/clang/lib/AST/ExprConstant.cpp#L8763 But there are more, and I always wonder if they can get out of sync. I wonder if this is time to introduce some helper functions that can be reused. 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