1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpTraversal -analyzer-max-loop 4 -std=c++11 %s | FileCheck -check-prefix=DFS %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambucint a(); 4*f4a2713aSLionel Sambucint b(); 5*f4a2713aSLionel Sambucint c(); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambucint work(); 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambucvoid test(id input) { 10*f4a2713aSLionel Sambuc if (a()) { 11*f4a2713aSLionel Sambuc if (a()) 12*f4a2713aSLionel Sambuc b(); 13*f4a2713aSLionel Sambuc else 14*f4a2713aSLionel Sambuc c(); 15*f4a2713aSLionel Sambuc } else { 16*f4a2713aSLionel Sambuc if (b()) 17*f4a2713aSLionel Sambuc a(); 18*f4a2713aSLionel Sambuc else 19*f4a2713aSLionel Sambuc c(); 20*f4a2713aSLionel Sambuc } 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc if (a()) 23*f4a2713aSLionel Sambuc work(); 24*f4a2713aSLionel Sambuc} 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambucvoid testLoops(id input) { 27*f4a2713aSLionel Sambuc while (a()) { 28*f4a2713aSLionel Sambuc work(); 29*f4a2713aSLionel Sambuc work(); 30*f4a2713aSLionel Sambuc work(); 31*f4a2713aSLionel Sambuc } 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc for (int i = 0; i != b(); ++i) { 34*f4a2713aSLionel Sambuc work(); 35*f4a2713aSLionel Sambuc } 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc for (id x in input) { 38*f4a2713aSLionel Sambuc work(); 39*f4a2713aSLionel Sambuc work(); 40*f4a2713aSLionel Sambuc work(); 41*f4a2713aSLionel Sambuc } 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc int z[] = {1,2,3}; 44*f4a2713aSLionel Sambuc for (int y : z) { 45*f4a2713aSLionel Sambuc work(); 46*f4a2713aSLionel Sambuc work(); 47*f4a2713aSLionel Sambuc work(); 48*f4a2713aSLionel Sambuc } 49*f4a2713aSLionel Sambuc} 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel Sambuc// This ordering assumes that false cases happen before the true cases. 52*f4a2713aSLionel Sambuc 53*f4a2713aSLionel Sambuc// DFS:27 WhileStmt 54*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 55*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 56*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 57*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 58*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 59*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 60*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 61*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 62*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 63*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 64*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 65*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 66*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 67*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 68*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 69*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 70*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 71*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 72*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 73*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 74*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 75*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 76*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 77*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 78*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 79*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 80*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 81*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 82*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 83*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 84*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 85*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 86*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 87*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 88*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 89*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 90*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 91*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 92*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 93*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 94*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 95*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 96*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 97*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 98*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 99*f4a2713aSLionel Sambuc// DFS-next:27 WhileStmt 100*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 101*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 102*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 103*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 104*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 105*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 106*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 107*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 108*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 109*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 110*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 111*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 112*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 113*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 114*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 115*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 116*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 117*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 118*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 119*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 120*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 121*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 122*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 123*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 124*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 125*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 126*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 127*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 128*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 129*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 130*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 131*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 132*f4a2713aSLionel Sambuc// DFS-next:27 WhileStmt 133*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 134*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 135*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 136*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 137*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 138*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 139*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 140*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 141*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 142*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 143*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 144*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 145*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 146*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 147*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 148*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 149*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 150*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 151*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 152*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 153*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 154*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 155*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 156*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 157*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 158*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 159*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 160*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 161*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 162*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 163*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 164*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 165*f4a2713aSLionel Sambuc// DFS-next:27 WhileStmt 166*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 167*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 168*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 169*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 170*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 171*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 172*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 173*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 174*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 175*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 176*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 177*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 178*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 179*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 180*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 181*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 182*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 183*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 184*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 185*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 186*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 187*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 188*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 189*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 190*f4a2713aSLionel Sambuc// DFS-next:33 ForStmt 191*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 192*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 193*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 194*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 195*f4a2713aSLionel Sambuc// DFS-next:44 CXXForRangeStmt 196*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 197*f4a2713aSLionel Sambuc// DFS-next:37 ObjCForCollectionStmt 198*f4a2713aSLionel Sambuc// DFS-next:10 IfStmt 199*f4a2713aSLionel Sambuc// DFS-next:16 IfStmt 200*f4a2713aSLionel Sambuc// DFS-next:22 IfStmt 201*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 202*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 203*f4a2713aSLionel Sambuc// DFS-next:22 IfStmt 204*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 205*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 206*f4a2713aSLionel Sambuc// DFS-next:11 IfStmt 207*f4a2713aSLionel Sambuc// DFS-next:22 IfStmt 208*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 209*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 210*f4a2713aSLionel Sambuc// DFS-next:22 IfStmt 211*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 212*f4a2713aSLionel Sambuc// DFS-next:--END PATH-- 213*f4a2713aSLionel Sambuc 214