As of r202325, CFGBlock predecessors may be NULL. Ignore such preds. Fixes a crasher, PR18983.

llvm-svn: 202340
This commit is contained in:
Nick Lewycky 2014-02-27 02:43:25 +00:00
parent c204c130fa
commit cdf1108b61
2 changed files with 14 additions and 0 deletions

View File

@ -887,6 +887,7 @@ namespace {
while (!BlockQueue.empty()) {
const CFGBlock *P = BlockQueue.front();
BlockQueue.pop_front();
if (!P) continue;
const Stmt *Term = P->getTerminator();
if (Term && isa<SwitchStmt>(Term))

View File

@ -265,3 +265,16 @@ void fallthrough_in_local_class() {
};
}
namespace PR18983 {
void fatal() __attribute__((noreturn));
int num();
void test() {
switch (num()) {
case 1:
fatal();
// Don't issue a warning.
case 2:
break;
}
}
}