================
@@ -70,6 +80,19 @@ class LifetimeSafetySemaHelperImpl : public
LifetimeSafetySemaHelper {
S.Diag(MovedExpr->getExprLoc(), diag::note_lifetime_safety_moved_here)
<< MovedExpr->getSourceRange();
S.Diag(FreeLoc, diag::note_lifetime_safety_destroyed_here);
+
+ StringRef IssueStr;
+ for (const Expr *CurrExpr : reverse(OriginExprChain)) {
+ if (IssueStr.empty()) {
+ IssueStr = formatExpr(CurrExpr);
+ continue;
+ }
+
+ S.Diag(CurrExpr->getBeginLoc(),
+ diag::note_lifetime_safety_note_alias_chain)
+ << CurrExpr->getSourceRange() << formatExpr(CurrExpr) << IssueStr;
+ }
----------------
usx95 wrote:
Let's do this in a separate method.
`void reportAliasingChain(llvm::ArrayRef<const Expr *> OriginExprChain);`
https://github.com/llvm/llvm-project/pull/199345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits