[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / AST / ast-dump-traits.cpp
blob3085e5883fd2e2836eea3932b4edc7c73cb07dfc
1 // Test without serialization:
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s \
3 // RUN: | FileCheck -strict-whitespace %s
4 //
5 // Test with serialization:
6 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -x c++ -include-pch %t -ast-dump-all /dev/null \
8 // RUN: | FileCheck -strict-whitespace %s
10 void test_type_trait() {
11 // An unary type trait.
12 enum E {};
13 (void) __is_enum(E);
14 // A binary type trait.
15 (void) __is_same(int ,float);
16 // An n-ary type trait.
17 (void) __is_constructible(int, int, int, int);
20 void test_array_type_trait() {
21 // An array type trait.
22 (void) __array_rank(int[10][20]);
25 void test_expression_trait() {
26 // An expression trait.
27 (void) __is_lvalue_expr(1);
30 void test_unary_expr_or_type_trait() {
31 // Some UETTs.
32 (void) sizeof(int);
33 (void) alignof(int);
34 (void) __alignof(int);
36 // CHECK: TranslationUnitDecl {{.*}} <<invalid sloc>> <invalid sloc>{{( <undeserialized declarations>)?}}
37 // CHECK: |-FunctionDecl {{.*}} <{{.*}}ast-dump-traits.cpp:10:1, line:18:1> line:10:6{{( imported)?}} test_type_trait 'void ()'
38 // CHECK-NEXT: | `-CompoundStmt {{.*}} <col:24, line:18:1>
39 // CHECK-NEXT: | |-DeclStmt {{.*}} <line:12:3, col:12>
40 // CHECK-NEXT: | | `-EnumDecl {{.*}} <col:3, col:11> col:8{{( imported)?}} referenced E
41 // CHECK-NEXT: | |-CStyleCastExpr {{.*}} <line:13:3, col:21> 'void' <ToVoid>
42 // CHECK-NEXT: | | `-TypeTraitExpr {{.*}} <col:10, col:21> 'bool' __is_enum
43 // CHECK-NEXT: | | `-ElaboratedType {{.*}} 'E' sugar
44 // CHECK-NEXT: | | `-EnumType {{.*}} 'E'
45 // CHECK-NEXT: | | `-Enum {{.*}} 'E'
46 // CHECK-NEXT: | |-CStyleCastExpr {{.*}} <line:15:3, col:30> 'void' <ToVoid>
47 // CHECK-NEXT: | | `-TypeTraitExpr {{.*}} <col:10, col:30> 'bool' __is_same
48 // CHECK-NEXT: | | |-BuiltinType {{.*}} 'int'
49 // CHECK-NEXT: | | `-BuiltinType {{.*}} 'float'
50 // CHECK-NEXT: | `-CStyleCastExpr {{.*}} <line:17:3, col:47> 'void' <ToVoid>
51 // CHECK-NEXT: | `-TypeTraitExpr {{.*}} <col:10, col:47> 'bool' __is_constructible
52 // CHECK-NEXT: |-BuiltinType {{.*}} 'int'
53 // CHECK-NEXT: |-BuiltinType {{.*}} 'int'
54 // CHECK-NEXT: |-BuiltinType {{.*}} 'int'
55 // CHECK-NEXT: `-BuiltinType {{.*}} 'int'
56 // CHECK-NEXT: |-FunctionDecl {{.*}} <line:20:1, line:23:1> line:20:6{{( imported)?}} test_array_type_trait 'void ()'
57 // CHECK-NEXT: | `-CompoundStmt {{.*}} <col:30, line:23:1>
58 // CHECK-NEXT: | `-CStyleCastExpr {{.*}} <line:22:3, col:34> 'void' <ToVoid>
59 // CHECK-NEXT: | `-ArrayTypeTraitExpr {{.*}} <col:10, col:34> 'unsigned long' __array_rank
60 // CHECK-NEXT: |-FunctionDecl {{.*}} <line:25:1, line:28:1> line:25:6{{( imported)?}} test_expression_trait 'void ()'
61 // CHECK-NEXT: | `-CompoundStmt {{.*}} <col:30, line:28:1>
62 // CHECK-NEXT: | `-CStyleCastExpr {{.*}} <line:27:3, col:28> 'void' <ToVoid>
63 // CHECK-NEXT: | `-ExpressionTraitExpr {{.*}} <col:10, col:28> 'bool' __is_lvalue_expr
64 // CHECK-NEXT: `-FunctionDecl {{.*}} <line:30:1, line:35:1> line:30:6{{( imported)?}} test_unary_expr_or_type_trait 'void ()'
65 // CHECK-NEXT: `-CompoundStmt {{.*}} <col:38, line:35:1>
66 // CHECK-NEXT: |-CStyleCastExpr {{.*}} <line:32:3, col:20> 'void' <ToVoid>
67 // CHECK-NEXT: | `-UnaryExprOrTypeTraitExpr {{.*}} <col:10, col:20> 'unsigned long' sizeof 'int'
68 // CHECK-NEXT: |-CStyleCastExpr {{.*}} <line:33:3, col:21> 'void' <ToVoid>
69 // CHECK-NEXT: | `-UnaryExprOrTypeTraitExpr {{.*}} <col:10, col:21> 'unsigned long' alignof 'int'
70 // CHECK-NEXT: `-CStyleCastExpr {{.*}} <line:34:3, col:23> 'void' <ToVoid>
71 // CHECK-NEXT: `-UnaryExprOrTypeTraitExpr {{.*}} <col:10, col:23> 'unsigned long' __alignof 'int'