[clang] [LifetimeSafety] Introduce buildOriginFlowChain for use-after-scope (PR #199345)

Yuan Suo via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 04:33:15 PDT 2026


================
@@ -471,13 +474,50 @@ class LifetimeSafetySemaHelperImpl : public LifetimeSafetySemaHelper {
   }
 
   std::string getDiagSubjectDescription(const Expr *E) {
+    // FIXME: Ideally, this should use IgnoreParenImpCasts().
+    // However, according to the comment on IgnoreParenImpCasts(),
+    // it is not fully equivalent to IgnoreImpCasts() + IgnoreParens().
+    // Once the FIXME in IgnoreParenImpCasts() is resolved,
+    // this can be switched to use IgnoreParenImpCasts().
+    E = E->IgnoreImpCasts()->IgnoreParens();
----------------
suoyuan666 wrote:

Hmm... For an expression like `(((a)))`, what I ultimately want to obtain is the corresponding `DeclRefExpr` for `a`.

Of course, I may be missing something here, but I'm also fine with removing this handling altogether and no longer printing `ParenExpr`.


https://github.com/llvm/llvm-project/pull/199345


More information about the cfe-commits mailing list