================
@@ -226,6 +226,21 @@ static bool isPossiblyEscaped(ExplodedNode *N, const 
DeclRefExpr *DR) {
           return false;
       }
     }
+
+    if (const SwitchStmt *SS = dyn_cast<SwitchStmt>(S)) {
+      if (const CompoundStmt *CST = dyn_cast<CompoundStmt>(SS->getBody())) {
+        for (const Stmt *CB : CST->body()) {
+          if (const DeclStmt *DST = dyn_cast<DeclStmt>(CB)) {
+            for (const Decl *D : DST->decls()) {
+              // Once we reach the declaration of the VD we can return.
+              if (D->getCanonicalDecl() == VD)
+                return false;
+            }
+          }
----------------
steakhal wrote:

This is duplicated from the previous check. Consider refactoring the code to 
hoist and name the common functionality.

https://github.com/llvm/llvm-project/pull/82089
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to