413 lines · c
1// Test without serialization:2// RUN: %clang_cc1 -std=gnu11 -ast-dump %s \3// RUN: | FileCheck -strict-whitespace %s4//5// Test with serialization:6// RUN: %clang_cc1 -std=gnu11 -emit-pch -o %t %s7// RUN: %clang_cc1 -x c -std=gnu11 -include-pch %t -ast-dump-all /dev/null \8// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \9// RUN: | FileCheck -strict-whitespace %s10 11int TestLocation = 0;12// CHECK: VarDecl{{.*}}TestLocation13// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:20> 'int' 014 15int TestIndent = 1 + (1);16// CHECK: VarDecl{{.*}}TestIndent17// CHECK-NEXT: {{^}}| `-BinaryOperator{{[^()]*$}}18// CHECK-NEXT: {{^}}| |-IntegerLiteral{{.*0[^()]*$}}19// CHECK-NEXT: {{^}}| `-ParenExpr{{.*0[^()]*$}}20// CHECK-NEXT: {{^}}| `-IntegerLiteral{{.*0[^()]*$}}21 22void TestDeclStmt(void) {23 int x = 0;24 int y, z;25}26// CHECK: FunctionDecl{{.*}}TestDeclStmt27// CHECK-NEXT: CompoundStmt28// CHECK-NEXT: DeclStmt29// CHECK-NEXT: VarDecl{{.*}}x30// CHECK-NEXT: IntegerLiteral31// CHECK-NEXT: DeclStmt32// CHECK-NEXT: VarDecl{{.*}}y33// CHECK-NEXT: VarDecl{{.*}}z34 35int TestOpaqueValueExpr = 0 ?: 1;36// CHECK: VarDecl{{.*}}TestOpaqueValueExpr37// CHECK-NEXT: BinaryConditionalOperator38// CHECK-NEXT: IntegerLiteral39// CHECK-NEXT: OpaqueValueExpr40// CHECK-NEXT: IntegerLiteral41// CHECK-NEXT: OpaqueValueExpr42// CHECK-NEXT: IntegerLiteral43// CHECK-NEXT: IntegerLiteral44 45void TestUnaryOperatorExpr(void) {46 char T1 = 1;47 int T2 = 1;48 49 T1++;50 T2++;51 // CHECK: UnaryOperator{{.*}}postfix '++' cannot overflow52 // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'53 // CHECK-NOT: UnaryOperator{{.*}}postfix '++' cannot overflow54 // CHECK: DeclRefExpr{{.*}}'T2' 'int'55 56 -T1;57 -T2;58 // CHECK: UnaryOperator{{.*}}prefix '-' cannot overflow59 // CHECK-NEXT: ImplicitCastExpr60 // CHECK-NEXT: ImplicitCastExpr61 // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'62 // CHECK-NOT: UnaryOperator{{.*}}prefix '-' cannot overflow63 // CHECK: ImplicitCastExpr64 // CHECK: DeclRefExpr{{.*}}'T2' 'int'65 66 ~T1;67 ~T2;68 // CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow69 // CHECK-NEXT: ImplicitCastExpr70 // CHECK-NEXT: ImplicitCastExpr71 // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'72 // CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow73 // CHECK-NEXT: ImplicitCastExpr74 // CHECK-NEXT: DeclRefExpr{{.*}}'T2' 'int'75}76 77void TestGenericSelectionExpressions(int i) {78 _Generic(i, int : 12);79 // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:23> 'int'80 // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}81 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'82 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'83 // FIXME: note that the following test line has a spurious whitespace.84 // CHECK-NEXT: case 'int' selected85 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'86 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 1287 _Generic(i, int : 12, default : 0);88 // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:36> 'int'89 // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}90 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'91 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'92 // FIXME: note that the following test line has a spurious whitespace.93 // CHECK-NEXT: case 'int' selected94 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'95 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 1296 // CHECK-NEXT: default97 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:35> 'int' 098 _Generic(i, default : 0, int : 12);99 // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:36> 'int'100 // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}101 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'102 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'103 // CHECK-NEXT: default104 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:25> 'int' 0105 // FIXME: note that the following test line has a spurious whitespace.106 // CHECK-NEXT: case 'int' selected107 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'108 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:34> 'int' 12109 _Generic(i, int : 12, float : 10, default : 100);110 // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:50> 'int'111 // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}112 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'113 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'114 // FIXME: note that the following test line has a spurious whitespace.115 // CHECK-NEXT: case 'int' selected116 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'117 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12118 // FIXME: note that the following test line has a spurious whitespace.119 // CHECK-NEXT: case 'float'120 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'float'121 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:33> 'int' 10122 // CHECK-NEXT: default123 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:47> 'int' 100124 125 int j = _Generic(i, int : 12);126 // CHECK: DeclStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:32>127 // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:3, col:31> col:7 j 'int' cinit128 // CHECK-NEXT: GenericSelectionExpr 0x{{[^ ]*}} <col:11, col:31> 'int'129 // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}130 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:20> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'131 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'132 // FIXME: note that the following test line has a spurious whitespace.133 // CHECK-NEXT: case 'int' selected134 // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'135 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:29> 'int' 12136}137 138void TestLabelsAndGoto(void) {139 // Note: case and default labels are handled by TestSwitch().140 141label1:142 ;143 // CHECK: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:3> 'label1'144 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <col:3>145 146 goto label2;147 // CHECK-NEXT: GotoStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:8> 'label2' 0x{{[^ ]*}}148 149label2:150 0;151 // CHECK-NEXT: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:3> 'label2'152 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:3> 'int' 0153 154 void *ptr = &&label1;155 // CHECK-NEXT: DeclStmt156 // CHECK-NEXT: VarDecl157 // CHECK-NEXT: AddrLabelExpr 0x{{[^ ]*}} <col:15, col:17> 'void *' label1 0x{{[^ ]*}}158 159 goto *ptr;160 // CHECK-NEXT: IndirectGotoStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9>161 // CHECK-NEXT: ImplicitCastExpr162 // CHECK-NEXT: ImplicitCastExpr163 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:9> 'void *' lvalue Var 0x{{[^ ]*}} 'ptr' 'void *'164 165label3:166 // CHECK-NEXT: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:1, col:7> 'label3'167 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <col:7>168}169 170void TestSwitch(int i) {171 switch (i) {172 // CHECK: SwitchStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, line:[[@LINE+37]]:3>173 // CHECK-NEXT: ImplicitCastExpr174 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'175 // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:14, line:[[@LINE+34]]:3>176 case 0:177 break;178 // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>179 // CHECK-NEXT: ConstantExpr180 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 0181 // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:5>182 case 1:183 case 2:184 break;185 // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:3, line:[[@LINE-1]]:5>186 // CHECK-NEXT: ConstantExpr187 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 1188 // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:3, line:[[@LINE-4]]:5>189 // CHECK-NEXT: ConstantExpr190 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 2191 // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-7]]:5>192 default:193 break;194 // CHECK-NEXT: DefaultStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>195 // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <col:5>196 case 3 ... 5:197 break;198 // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5> gnu_range199 // CHECK-NEXT: ConstantExpr200 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 3201 // CHECK-NEXT: ConstantExpr202 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:14> 'int' 5203 // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>204 case 6:205 // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9>206 // CHECK-NEXT: ConstantExpr207 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 6208 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <col:9>209 }210 211 switch(i){212 // CHECK: SwitchStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, line:[[@LINE+7]]:3>213 // CHECK-NEXT: ImplicitCastExpr214 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'215 // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:12, line:[[@LINE+4]]:3>216 default:217 // CHECK-NEXT: DefaultStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:10>218 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <col:10>219 }220}221 222void TestIf(_Bool b) {223 if (b)224 ;225 // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>226 // CHECK-NEXT: ImplicitCastExpr227 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'228 // CHECK-NEXT: NullStmt229 230 if (b) {}231 // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:11>232 // CHECK-NEXT: ImplicitCastExpr233 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'234 // CHECK-NEXT: CompoundStmt235 236 if (b)237 ;238 else239 ;240 // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:3, line:[[@LINE-1]]:5> has_else241 // CHECK-NEXT: ImplicitCastExpr242 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'243 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>244 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:5>245 246 if (b) {}247 else {}248 // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:9> has_else249 // CHECK-NEXT: ImplicitCastExpr250 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'251 // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:10, col:11>252 // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:8, col:9>253 254 if (b)255 ;256 else if (b)257 ;258 // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:3, line:[[@LINE-1]]:5> has_else259 // CHECK-NEXT: ImplicitCastExpr260 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'261 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>262 // CHECK-NEXT: IfStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:8, line:[[@LINE-5]]:5>263 // CHECK-NEXT: ImplicitCastExpr264 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'265 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:5>266 267 if (b)268 ;269 else if (b)270 ;271 else272 ;273 // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:3, line:[[@LINE-1]]:5> has_else274 // CHECK-NEXT: ImplicitCastExpr275 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'276 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:5>277 // CHECK-NEXT: IfStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:8, line:[[@LINE-5]]:5> has_else278 // CHECK-NEXT: ImplicitCastExpr279 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'280 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-10]]:5>281 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-9]]:5>282}283 284void TestIteration(_Bool b) {285 while (b)286 ;287 // CHECK: WhileStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>288 // CHECK-NEXT: ImplicitCastExpr289 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'290 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:5>291 292 do293 ;294 while (b);295 // CHECK: DoStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:3, line:[[@LINE-1]]:11>296 // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:5>297 // CHECK-NEXT: ImplicitCastExpr298 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'299 300 for (int i = 0; i < 10; ++i)301 ;302 // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>303 // CHECK-NEXT: DeclStmt304 // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:8, col:16> col:12 used i 'int' cinit305 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:16> 'int' 0306 // CHECK-NEXT: <<<NULL>>>307 // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:19, col:23> 'int' '<'308 // CHECK-NEXT: ImplicitCastExpr309 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:19> 'int' lvalue Var 0x{{[^ ]*}} 'i' 'int'310 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:23> 'int' 10311 // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:27, col:29> 'int' prefix '++'312 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:29> 'int' lvalue Var 0x{{[^ ]*}} 'i' 'int'313 // CHECK-NEXT: NullStmt314 315 for (b; b; b)316 ;317 // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>318 // CHECK-NEXT: ImplicitCastExpr319 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:8> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'320 // CHECK-NEXT: <<<NULL>>>321 // CHECK-NEXT: ImplicitCastExpr322 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'323 // CHECK-NEXT: ImplicitCastExpr324 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'325 // CHECK-NEXT: NullStmt326 327 for (; b; b = !b)328 ;329 // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>330 // CHECK-NEXT: <<<NULL>>>331 // CHECK-NEXT: <<<NULL>>>332 // CHECK-NEXT: ImplicitCastExpr333 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'334 // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:13, col:18> '_Bool' '='335 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:13> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'336 // CHECK-NEXT: ImplicitCastExpr337 // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:17, col:18> 'int' prefix '!' cannot overflow338 // CHECK-NEXT: ImplicitCastExpr339 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:18> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'340 // CHECK-NEXT: NullStmt341 342 for (; b;)343 ;344 // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>345 // CHECK-NEXT: <<<NULL>>>346 // CHECK-NEXT: <<<NULL>>>347 // CHECK-NEXT: ImplicitCastExpr348 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'349 // CHECK-NEXT: <<<NULL>>>350 // CHECK-NEXT: NullStmt351 352 for (;; b = !b)353 ;354 // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>355 // CHECK-NEXT: <<<NULL>>>356 // CHECK-NEXT: <<<NULL>>>357 // CHECK-NEXT: <<<NULL>>>358 // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <line:[[@LINE-6]]:11, col:16> '_Bool' '='359 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'360 // CHECK-NEXT: ImplicitCastExpr361 // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:15, col:16> 'int' prefix '!' cannot overflow362 // CHECK-NEXT: ImplicitCastExpr363 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:16> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'364 // CHECK-NEXT: NullStmt365 366 for (;;)367 ;368 // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>369 // CHECK-NEXT: <<<NULL>>>370 // CHECK-NEXT: <<<NULL>>>371 // CHECK-NEXT: <<<NULL>>>372 // CHECK-NEXT: <<<NULL>>>373 // CHECK-NEXT: NullStmt374}375 376void TestJumps(void) {377 // goto and computed goto was tested in TestLabelsAndGoto().378 379 while (1) {380 continue;381 // CHECK: ContinueStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:5>382 break;383 // CHECK: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:5>384 }385 return;386 // CHECK: ReturnStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3>387 388 return TestSwitch(1);389 // CHECK: ReturnStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:22>390 // CHECK-NEXT: CallExpr 0x{{[^ ]*}} <col:10, col:22> 'void'391}392 393void TestMiscStmts(void) {394 ({int a = 10; a;});395 // CHECK: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:20> 'int'396 // CHECK-NEXT: CompoundStmt397 // CHECK-NEXT: DeclStmt398 // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:5, col:13> col:9 used a 'int' cinit399 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:13> 'int' 10400 // CHECK-NEXT: ImplicitCastExpr401 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:17> 'int' lvalue Var 0x{{[^ ]*}} 'a' 'int'402 ({int a = 10; a;;; });403 // CHECK-NEXT: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:23> 'void'404 // CHECK-NEXT: CompoundStmt405 // CHECK-NEXT: DeclStmt406 // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:5, col:13> col:9 used a 'int' cinit407 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:13> 'int' 10408 // CHECK-NEXT: ImplicitCastExpr409 // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:17> 'int' lvalue Var 0x{{[^ ]*}} 'a' 'int'410 // CHECK-NEXT: NullStmt411 // CHECK-NEXT: NullStmt412}413