Fix a horrible CFG bug reported in <rdar://problem/7027684>. The wrong successor

block would get hooked up in some cases when processing empty compound
statements.

llvm-svn: 74743
This commit is contained in:
Ted Kremenek 2009-07-03 00:10:50 +00:00
parent 38a22bffdc
commit 0b0f206efa
2 changed files with 13 additions and 1 deletions

View File

@ -556,7 +556,7 @@ CFGBlock* CFGBuilder::VisitNullStmt(NullStmt* Statement) {
CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
CFGBlock* LastBlock = NULL;
CFGBlock* LastBlock = Block;
for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
I != E; ++I ) {

View File

@ -284,3 +284,15 @@ int test_invalidate_by_ref() {
return 0;
}
// Test for <rdar://problem/7027684>. This just tests that the CFG is
// constructed correctly. Previously, the successor block of the entrance
// was the block containing the merge for '?', which would trigger an
// assertion failure.
int rdar_7027684_aux();
int rdar_7027684_aux_2() __attribute__((noreturn));
void rdar_7027684(int x, int y) {
{}; // this empty compound statement is critical.
(rdar_7027684_aux() ? rdar_7027684_aux_2() : (void) 0);
}