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