================
@@ -2919,6 +2919,30 @@ 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;
+ if (auto *TSI = MD->getTypeSourceInfo())
+ InsertionPoint =
+ Lexer::getLocForEndOfToken(TSI->getTypeLoc().getEndLoc(), 0,
+ S.getSourceManager(), S.getLangOpts());
+ else
+ InsertionPoint = MD->getLocation();
----------------
Xazax-hun wrote:
Did you check in what cases are we taking this branch? I wonder if
`MD->getLocation()` would be the beginning of the method which is probably not
where we want to insert the annotation.
https://github.com/llvm/llvm-project/pull/176703
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits