================
@@ -54,14 +54,24 @@ inline bool IsLifetimeSafetyEnabled(Sema &S, const Decl *D) 
{
   return false;
 }
 
+inline StringRef formatExpr(const Expr *E) {
+  const Expr *PureExpr = E->IgnoreImpCasts();
----------------
usx95 wrote:

So there are two things happening: 
1. Decide whether an expression (associated to some origin in the chain) should 
be printed or not. My suggestion is that for this decision, we should introduce 
`bool shouldShowInAliasingChain(const Expr* CurExpr, const Expr* LastExpr)` 
which rejects some expressions like ParenCast, ImplicitCast, expressions having 
same range with previous expr. 

  > it seems that we should introduce a recursive sub-expression handling 
method to first extract all expressions that could potentially be stripped from 
E.

  This is key here. We do not have to do that. The stripped expression should 
already be a part of the origin chain by construction.

  This would all be part of the `reportAliasingChain` where this decision will 
be used.


2. The formatted text. We now already have a utility `getDiagSubjectDescription 
` to do that centrally. `reportAliasingChain` should reuse it to format the 
expression string.

https://github.com/llvm/llvm-project/pull/199345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to