2012-07-03 05:02:22 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpTraversal -analyzer-max-loop 4 -std=c++11 %s | FileCheck -check-prefix=DFS %s
|
2012-06-29 08:33:10 +08:00
|
|
|
|
|
|
|
int a();
|
|
|
|
int b();
|
|
|
|
int c();
|
|
|
|
|
|
|
|
int work();
|
|
|
|
|
|
|
|
void test(id input) {
|
|
|
|
if (a()) {
|
|
|
|
if (a())
|
|
|
|
b();
|
|
|
|
else
|
|
|
|
c();
|
|
|
|
} else {
|
|
|
|
if (b())
|
|
|
|
a();
|
|
|
|
else
|
|
|
|
c();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a())
|
|
|
|
work();
|
|
|
|
}
|
|
|
|
|
|
|
|
void testLoops(id input) {
|
|
|
|
while (a()) {
|
|
|
|
work();
|
|
|
|
work();
|
|
|
|
work();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i != b(); ++i) {
|
|
|
|
work();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (id x in input) {
|
|
|
|
work();
|
|
|
|
work();
|
|
|
|
work();
|
|
|
|
}
|
|
|
|
|
|
|
|
int z[] = {1,2,3};
|
|
|
|
for (int y : z) {
|
|
|
|
work();
|
|
|
|
work();
|
|
|
|
work();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-03 04:21:48 +08:00
|
|
|
// This ordering assumes that false cases happen before the true cases.
|
|
|
|
|
|
|
|
// DFS:27 WhileStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:27 WhileStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:27 WhileStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:27 WhileStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:33 ForStmt
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:44 CXXForRangeStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:37 ObjCForCollectionStmt
|
|
|
|
// DFS-next:10 IfStmt
|
|
|
|
// DFS-next:16 IfStmt
|
|
|
|
// DFS-next:22 IfStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:22 IfStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:11 IfStmt
|
|
|
|
// DFS-next:22 IfStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:22 IfStmt
|
|
|
|
// DFS-next:--END PATH--
|
|
|
|
// DFS-next:--END PATH--
|
2012-06-29 08:33:10 +08:00
|
|
|
|