[analyzer] Don't run unreachable code checker on inlined functions.

This is still an alpha checker, but we use it in certain tests to make sure
something is not being executed.

This should fix the buildbots.

llvm-svn: 188682
This commit is contained in:
Jordan Rose 2013-08-19 17:03:12 +00:00
parent 23b2f755ce
commit 95cdf9d603
2 changed files with 22 additions and 0 deletions

View File

@ -67,9 +67,12 @@ void UnreachableCodeChecker::checkEndAnalysis(ExplodedGraph &G,
I != E; ++I) {
const ProgramPoint &P = I->getLocation();
LC = P.getLocationContext();
if (!LC->inTopFrame())
continue;
if (!D)
D = LC->getAnalysisDeclContext()->getDecl();
// Save the CFG if we don't have it already
if (!C)
C = LC->getAnalysisDeclContext()->getUnoptimizedCFG();

View File

@ -139,3 +139,22 @@ void test11(enum foobar fb) {
error(); // expected-warning {{never executed}}
}
}
void inlined(int condition) {
if (condition) {
foo(5); // no-warning
} else {
foo(6);
}
}
void testInlined() {
extern int coin();
int cond = coin();
if (!cond) {
inlined(0);
if (cond) {
foo(5); // expected-warning {{never executed}}
}
}
}