forked from OSchip/llvm-project
[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:
parent
23b2f755ce
commit
95cdf9d603
|
@ -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();
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue