1 // RUN: not %clang_cc1 -triple x86_64-unknown-unknown -frecovery-ast -fno-recovery-ast-type -ast-dump %s | FileCheck -strict-whitespace %s
5 // CHECK: VarDecl {{.*}} unmatch_arg_call 'int' cinit
6 // CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
7 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'some_func'
8 int unmatch_arg_call
= some_func();
12 // CHECK: VarDecl {{.*}} postfix_inc
13 // CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
14 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'a'
15 int postfix_inc
= a
++;
17 // CHECK: VarDecl {{.*}} unary_address
18 // CHECK-NEXT:`-RecoveryExpr {{.*}} contains-errors
19 // CHECK-NEXT: `-ParenExpr {{.*}}
20 // CHECK-NEXT: `-BinaryOperator {{.*}} '+'
21 // CHECK-NEXT: |-ImplicitCastExpr
22 // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'a'
23 // CHECK-NEXT: `-IntegerLiteral {{.*}} 'int'
24 int unary_address
= &(a
+ 1);
26 // CHECK: VarDecl {{.*}} ternary 'int' cinit
27 // CHECK-NEXT: `-ConditionalOperator {{.*}}
28 // CHECK-NEXT: |-DeclRefExpr {{.*}} 'a'
29 // CHECK-NEXT: |-RecoveryExpr {{.*}}
30 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'a'
31 int ternary
= a
? undef
: a
;
34 // CHECK: `-RecoveryExpr {{.*}} contains-errors
35 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'a' 'const int'
36 static int foo
= a
++; // verify no crash on local static var decl.
41 // CHECK: BinaryOperator {{.*}} 'int *' contains-errors '='
42 // CHECK-NEXT: |-DeclRefExpr {{.*}} 'ptr' 'int *'
43 // CHECK-NEXT: `-RecoveryExpr {{.*}}
44 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'some_func'
45 ptr
= some_func(); // should not crash
48 // CHECK: CompoundAssignOperator {{.*}} 'int' contains-errors '+='
49 // CHECK-NEXT: |-DeclRefExpr {{.*}} 'compoundOp'
50 // CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
51 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'some_func'
52 compoundOp
+= some_func();
54 // CHECK: BinaryOperator {{.*}} 'int' contains-errors '||'
55 // CHECK-NEXT: |-RecoveryExpr {{.*}}
56 // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'some_func'
57 // CHECK-NEXT: `-IntegerLiteral {{.*}} 'int' 1
60 // CHECK: BinaryOperator {{.*}} '<dependent type>' contains-errors ','
61 // CHECK-NEXT: |-IntegerLiteral {{.*}} 'int' 1
62 // CHECK-NEXT: `-RecoveryExpr {{.*}}
63 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'some_func'
65 // CHECK: BinaryOperator {{.*}} 'int' contains-errors ','
66 // CHECK-NEXT: |-RecoveryExpr {{.*}} '<dependent type>'
67 // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'some_func'
68 // CHECK-NEXT: `-IntegerLiteral {{.*}} 'int' 1
71 // conditional operator (comparison is invalid)
73 // CHECK: ConditionalOperator {{.*}} '<dependent type>' contains-errors
74 // CHECK-NEXT: |-RecoveryExpr {{.*}} '<dependent type>'
75 // CHECK-NEXT: | |-DeclRefExpr {{.*}} 'int *' lvalue
76 // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'float' lvalue
77 // CHECK-NEXT: |-DeclRefExpr {{.*}} 'int *' lvalue
78 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'float' lvalue
81 // CHECK: CStyleCastExpr {{.*}} 'float' contains-errors <Dependent>
82 // CHECK-NEXT: `-RecoveryExpr {{.*}} '<dependent type>'
83 // CHECK-NEXT: `-DeclRefExpr {{.*}} 'some_func'
88 // CHECK: CallExpr {{.*}} '<dependent type>' contains-errors
89 // CHECK-NEXT: |-ParenExpr {{.*}} contains-errors lvalue
90 // CHECK-NEXT: | `-RecoveryExpr {{.*}} contains-errors
91 // CHECK-NEXT: | `-DeclRefExpr {{.*}} '__builtin_classify_type'
92 // CHECK-NEXT: `-IntegerLiteral {{.*}} 'int' 1
93 (*__builtin_classify_type
)(1);
96 // CHECK: CallExpr {{.*}} 'void' contains-errors
97 // CHECK-NEXT: |-DeclRefExpr {{.*}} 'ext'
98 // CHECK-NEXT: `-RecoveryExpr {{.*}} '<dependent type>'