[StaticAnalyser] Add test case to ensure that unreachable code is found.

https://reviews.llvm.org/D24905

llvm-svn: 283096
This commit is contained in:
Daniel Marjamaki 2016-10-03 09:45:35 +00:00
parent 042a3c5a2d
commit fd1b3814b3
1 changed files with 12 additions and 1 deletions

View File

@ -161,7 +161,7 @@ void testInlined() {
// Don't warn about unreachable VarDecl.
void dostuff(int*A);
void varDecl(int X) {
void varDecl1(int X) {
switch (X) {
int A; // No warning here.
case 1:
@ -172,6 +172,17 @@ void varDecl(int X) {
break;
}
}
void varDecl2(int X) {
switch (X) {
int A=1; // expected-warning {{never executed}}
case 1:
dostuff(&A);
break;
case 2:
dostuff(&A);
break;
}
}
// Ensure that ExplodedGraph and unoptimized CFG match.
void test12(int x) {