[clang] [clang][StaticAnalyzer] Crash on loop unrolling mode (PR #82089)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 21 23:46:31 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list