[clang] [LifetimeSafety] Add multi-block support to buildOriginFlowChain (PR #204592)

Yuan Suo via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 06:56:38 PDT 2026


================
@@ -534,11 +534,24 @@ class LifetimeSafetySemaHelperImpl : public LifetimeSafetySemaHelper {
     return "expression";
   }
 
+  bool isInValidExpr(const Expr *E) {
+    if (const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
+      return DRE->getDecl()->isImplicit();
+    }
+
+    if (const auto *CE = dyn_cast<CallExpr>(E)) {
+      if (const auto *FE = CE->getDirectCallee())
+        return FE->isImplicit();
+    }
----------------
suoyuan666 wrote:

Sorry, I may have misunderstood. Are you referring to the test case that I mentioned earlier?

> ```cpp
> void foo() {
>  int *s;
>  {
>    int *(*func)(int *);
>    int tgt = 2;
>    int *a = &tgt;
>    s = func(a);
>  }
>
>  (void)*s;
> }
> ```

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


More information about the cfe-commits mailing list