[PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 14:03:52 PDT 2016

dcoughlin added a comment.

@danielmarjamaki I see what you mean -- thanks for providing the patch.

I don't think this is the right approach. It should be sufficient to reason about blocks and not individual statements; further some blocks may be non-empty but not have any statements.

Instead, I think the better approach is make sure the optimized and unoptimized CFGs match block IDs. It looks like the only situation where there is currently a mismatch is `do { } while (0);`.

I sketched out an approach on cfe-dev for hoisting block creation (but not edge creation) in CFGBuilder::VisitDoStmt() during CFG construction to match the other control flow constructs. That is the approach I would recommend taking.


More information about the cfe-commits mailing list