diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2014-02-27 02:43:25 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2014-02-27 02:43:25 +0000 |
| commit | cdf1108b613975282b225224d4cb2bda81dc7fa4 (patch) | |
| tree | 2ae8daf5f1c96e01cea5eeb300538aae4f21862d | |
| parent | c204c130fabdffa131d487ec1c701fc95dba0ffe (diff) | |
| download | bcm5719-llvm-cdf1108b613975282b225224d4cb2bda81dc7fa4.tar.gz bcm5719-llvm-cdf1108b613975282b225224d4cb2bda81dc7fa4.zip | |
As of r202325, CFGBlock predecessors may be NULL. Ignore such preds. Fixes a crasher, PR18983.
llvm-svn: 202340
| -rw-r--r-- | clang/lib/Sema/AnalysisBasedWarnings.cpp | 1 | ||||
| -rw-r--r-- | clang/test/SemaCXX/switch-implicit-fallthrough.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 099ef253736..e6f2f82dd27 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -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)) diff --git a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp index d7959238c6b..831324a64e9 100644 --- a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp +++ b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp @@ -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; + } + } +} |

