2012-11-07 08:33:12 +08:00
|
|
|
// RUN: %clang_cc1 -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
|
|
|
|
|
|
|
|
int TestLocation = 0;
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}TestLocation
|
|
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:20> 'int' 0
|
2012-11-07 08:33:12 +08:00
|
|
|
|
|
|
|
int TestIndent = 1 + (1);
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}TestIndent
|
2013-01-31 09:44:26 +08:00
|
|
|
// CHECK-NEXT: {{^}}`-BinaryOperator{{[^()]*$}}
|
|
|
|
// CHECK-NEXT: {{^}} |-IntegerLiteral{{.*0[^()]*$}}
|
|
|
|
// CHECK-NEXT: {{^}} `-ParenExpr{{.*0[^()]*$}}
|
|
|
|
// CHECK-NEXT: {{^}} `-IntegerLiteral{{.*0[^()]*$}}
|
2012-11-07 08:33:12 +08:00
|
|
|
|
|
|
|
void TestDeclStmt() {
|
|
|
|
int x = 0;
|
|
|
|
int y, z;
|
|
|
|
}
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: FunctionDecl{{.*}}TestDeclStmt
|
2012-11-07 08:33:12 +08:00
|
|
|
// CHECK-NEXT: CompoundStmt
|
|
|
|
// CHECK-NEXT: DeclStmt
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK-NEXT: VarDecl{{.*}}x
|
2012-11-07 08:33:12 +08:00
|
|
|
// CHECK-NEXT: IntegerLiteral
|
|
|
|
// CHECK-NEXT: DeclStmt
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK-NEXT: VarDecl{{.*}}y
|
|
|
|
// CHECK-NEXT: VarDecl{{.*}}z
|
2012-11-07 08:33:12 +08:00
|
|
|
|
|
|
|
int TestOpaqueValueExpr = 0 ?: 1;
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}TestOpaqueValueExpr
|
2012-11-07 08:33:12 +08:00
|
|
|
// CHECK-NEXT: BinaryConditionalOperator
|
|
|
|
// CHECK-NEXT: IntegerLiteral
|
|
|
|
// CHECK-NEXT: OpaqueValueExpr
|
|
|
|
// CHECK-NEXT: IntegerLiteral
|
2018-01-09 21:07:03 +08:00
|
|
|
// CHECK-NEXT: OpaqueValueExpr
|
|
|
|
// CHECK-NEXT: IntegerLiteral
|
|
|
|
// CHECK-NEXT: IntegerLiteral
|
|
|
|
|
|
|
|
void TestUnaryOperatorExpr(void) {
|
|
|
|
char T1 = 1;
|
|
|
|
int T2 = 1;
|
|
|
|
|
|
|
|
T1++;
|
|
|
|
T2++;
|
|
|
|
// CHECK: UnaryOperator{{.*}}postfix '++' cannot overflow
|
|
|
|
// CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
|
|
|
|
// CHECK-NOT: UnaryOperator{{.*}}postfix '++' cannot overflow
|
|
|
|
// CHECK: DeclRefExpr{{.*}}'T2' 'int'
|
|
|
|
|
|
|
|
-T1;
|
|
|
|
-T2;
|
|
|
|
// CHECK: UnaryOperator{{.*}}prefix '-' cannot overflow
|
|
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
|
|
// CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
|
|
|
|
// CHECK-NOT: UnaryOperator{{.*}}prefix '-' cannot overflow
|
|
|
|
// CHECK: ImplicitCastExpr
|
|
|
|
// CHECK: DeclRefExpr{{.*}}'T2' 'int'
|
|
|
|
|
|
|
|
~T1;
|
|
|
|
~T2;
|
|
|
|
// CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow
|
|
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
|
|
// CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
|
|
|
|
// CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow
|
|
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
|
|
// CHECK-NEXT: DeclRefExpr{{.*}}'T2' 'int'
|
|
|
|
}
|