================
@@ -2927,6 +2929,44 @@ class LifetimeSafetyReporterImpl : public
LifetimeSafetyReporter {
<< EscapeExpr->getSourceRange();
}
+ void suggestAnnotation(SuggestionScope Scope, const CXXMethodDecl *MD,
+ const Expr *EscapeExpr) override {
+ unsigned DiagID = (Scope == SuggestionScope::CrossTU)
+ ? diag::warn_lifetime_safety_this_cross_tu_suggestion
+ :
diag::warn_lifetime_safety_this_intra_tu_suggestion;
+
+ SourceLocation InsertionPoint;
+ InsertionPoint = Lexer::getLocForEndOfToken(
+ MD->getTypeSourceInfo()->getTypeLoc().getEndLoc(), 0,
+ S.getSourceManager(), S.getLangOpts());
+ S.Diag(InsertionPoint, DiagID)
+ << MD->getNameInfo().getSourceRange()
+ << FixItHint::CreateInsertion(InsertionPoint,
+ " [[clang::lifetimebound]]");
+ S.Diag(EscapeExpr->getBeginLoc(),
+ diag::note_lifetime_safety_suggestion_returned_here)
+ << EscapeExpr->getSourceRange();
+ }
+
+ void addLifetimeBoundToImplicitThis(const CXXMethodDecl *MD) override {
+ CXXMethodDecl *MutableMD = const_cast<CXXMethodDecl *>(MD);
+ ASTContext &Ctx = S.getASTContext();
+ if (lifetimes::implicitObjectParamIsLifetimeBound(MutableMD))
----------------
kashika0112 wrote:
Done
https://github.com/llvm/llvm-project/pull/176703
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits