[PATCH] D71791: [CFG] Fix an assertion failure with static initializers
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 20 17:34:03 PST 2019
xazax.hun created this revision.
xazax.hun added reviewers: Szelethus, NoQ.
xazax.hun added a project: clang.
Herald added subscribers: cfe-commits, Charusso, gamesh411, dkrupp, rnkovacs.
The branches protecting the static initializers have a `DeclStmt` as last `Stmt`. Since it is not an expression that will trigger an assertion failure in `CFGBlock::getLastCondition`.
This is triggered by the lifetime analysis that is currently in a fork. I am not sure what would be the best way to test this change here.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71791
Files:
clang/lib/Analysis/CFG.cpp
Index: clang/lib/Analysis/CFG.cpp
===================================================================
--- clang/lib/Analysis/CFG.cpp
+++ clang/lib/Analysis/CFG.cpp
@@ -5919,7 +5919,7 @@
return nullptr;
const Stmt *Cond = StmtElem->getStmt();
- if (isa<ObjCForCollectionStmt>(Cond))
+ if (isa<ObjCForCollectionStmt>(Cond) || isa<DeclStmt>(Cond))
return nullptr;
// Only ObjCForCollectionStmt is known not to be a non-Expr terminator, hence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71791.234994.patch
Type: text/x-patch
Size: 461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191221/be69ddfa/attachment.bin>
More information about the cfe-commits
mailing list