brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · 683df50 Raw
191 lines · c
1// Test without serialization:2// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -ast-dump -ast-dump-filter Test %s \3// RUN: | FileCheck --strict-whitespace %s4//5// Test with serialization:6// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -emit-pch -o %t %s7// RUN: %clang_cc1 -x c -triple x86_64-unknown-unknown -Wno-strict-prototypes -include-pch %t \8// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \9// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \10// RUN: | FileCheck --strict-whitespace %s11//12// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -ast-dump %s \13// RUN: | FileCheck -check-prefix CHECK-TU --strict-whitespace %s14//15// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=X \16// RUN: -triple x86_64-unknown-unknown -Wno-strict-prototypes -fmodule-map-file=%S/Inputs/module.modulemap \17// RUN: -ast-dump -ast-dump-filter Test %s -DMODULES \18// RUN: | FileCheck -check-prefix CHECK -check-prefix CHECK-MODULES --strict-whitespace %s19 20int TestLocation;21// CHECK: VarDecl 0x{{[^ ]*}} <{{.*}}:[[@LINE-1]]:1, col:5> col:5 TestLocation22 23#ifdef MODULES24#pragma clang module begin X25#endif26 27struct TestIndent {28  int x;29};30// CHECK:      {{^}}RecordDecl{{.*TestIndent[^()]*$}}31// CHECK-NEXT: {{^}}`-FieldDecl{{.*x[^()]*$}}32 33struct TestChildren {34  int x;35  struct y {36    int z;37  };38};39// CHECK:      RecordDecl{{.*}}TestChildren40// CHECK-NEXT:   FieldDecl{{.*}}x41// CHECK-NEXT:   RecordDecl{{.*}}y42// CHECK-NEXT:     FieldDecl{{.*}}z43 44// CHECK-TU: TranslationUnitDecl45 46void testLabelDecl(void) {47  __label__ TestLabelDecl;48  TestLabelDecl: goto TestLabelDecl;49}50// CHECK:      LabelDecl{{.*}} TestLabelDecl51 52typedef int TestTypedefDecl;53// CHECK:      TypedefDecl{{.*}} TestTypedefDecl 'int'54 55__module_private__ typedef int TestTypedefDeclPrivate;56// CHECK-MODULES:      TypedefDecl{{.*}} TestTypedefDeclPrivate 'int' __module_private__57 58enum TestEnumDecl {59  testEnumDecl60};61// CHECK:      EnumDecl{{.*}} TestEnumDecl62// CHECK-NEXT:   EnumConstantDecl{{.*}} testEnumDecl63 64struct TestEnumDeclAnon {65  enum {66    testEnumDeclAnon67  } e;68};69// CHECK:      RecordDecl{{.*}} TestEnumDeclAnon70// CHECK-NEXT:   EnumDecl{{.*> .*$}}71 72enum TestEnumDeclForward;73// CHECK:      EnumDecl{{.*}} TestEnumDeclForward74 75__module_private__ enum TestEnumDeclPrivate;76// CHECK-MODULE:      EnumDecl{{.*}} TestEnumDeclPrivate __module_private__77 78struct TestRecordDecl {79  int i;80};81// CHECK:      RecordDecl{{.*}} struct TestRecordDecl82// CHECK-NEXT:   FieldDecl83 84struct TestRecordDeclEmpty {85};86// CHECK:      RecordDecl{{.*}} struct TestRecordDeclEmpty87 88struct TestRecordDeclAnon1 {89  struct {90  } testRecordDeclAnon1;91};92// CHECK:      RecordDecl{{.*}} struct TestRecordDeclAnon193// CHECK-NEXT:   RecordDecl{{.*}} struct94 95struct TestRecordDeclAnon2 {96  struct {97  };98};99// CHECK:      RecordDecl{{.*}} struct TestRecordDeclAnon2100// CHECK-NEXT:   RecordDecl{{.*}} struct101 102struct TestRecordDeclForward;103// CHECK:      RecordDecl{{.*}} struct TestRecordDeclForward104 105__module_private__ struct TestRecordDeclPrivate;106// CHECK-MODULE:      RecordDecl{{.*}} struct TestRecordDeclPrivate __module_private__107 108enum testEnumConstantDecl {109  TestEnumConstantDecl,110  TestEnumConstantDeclInit = 1111};112// CHECK:      EnumConstantDecl{{.*}} TestEnumConstantDecl 'int'113// CHECK:      EnumConstantDecl{{.*}} TestEnumConstantDeclInit 'int'114// CHECK-NEXT:   ConstantExpr115// CHECK-NEXT:     value: Int 1116// CHECK-NEXT:       IntegerLiteral117 118struct testIndirectFieldDecl {119  struct {120    int TestIndirectFieldDecl;121  };122};123// CHECK:      IndirectFieldDecl{{.*}} TestIndirectFieldDecl 'int'124// CHECK-NEXT:   Field{{.*}} field_index 0125// CHECK-NEXT:   Field{{.*}} 'TestIndirectFieldDecl'126 127// FIXME: It would be nice to dump the enum and its enumerators.128int TestFunctionDecl(int x, enum { e } y) {129  return x;130}131// CHECK:      FunctionDecl{{.*}} TestFunctionDecl 'int (int, enum {{.*}})'132// CHECK-NEXT:   ParmVarDecl{{.*}} x133// CHECK-NEXT:   ParmVarDecl{{.*}} y134// CHECK-NEXT:   CompoundStmt135 136// FIXME: It would be nice to 'Enum' and 'e'.137int TestFunctionDecl2(enum Enum { e } x) { return x; }138// CHECK:      FunctionDecl{{.*}} TestFunctionDecl2 'int (enum {{.*}})'139// CHECK-NEXT:   ParmVarDecl{{.*}} x140// CHECK-NEXT:   CompoundStmt141 142 143int TestFunctionDeclProto(int x);144// CHECK:      FunctionDecl{{.*}} TestFunctionDeclProto 'int (int)'145// CHECK-NEXT:   ParmVarDecl{{.*}} x146 147void TestFunctionDeclNoProto();148// CHECK:      FunctionDecl{{.*}} TestFunctionDeclNoProto 'void ()'149 150extern int TestFunctionDeclSC(void);151// CHECK:      FunctionDecl{{.*}} TestFunctionDeclSC 'int (void)' extern152 153inline int TestFunctionDeclInline(void);154// CHECK:      FunctionDecl{{.*}} TestFunctionDeclInline 'int (void)' inline155 156struct testFieldDecl {157  int TestFieldDecl;158  int TestFieldDeclWidth : 1;159  __module_private__ int TestFieldDeclPrivate;160};161// CHECK:      FieldDecl{{.*}} TestFieldDecl 'int'162// CHECK:      FieldDecl{{.*}} TestFieldDeclWidth 'int'163// CHECK-NEXT:   ConstantExpr164// CHECK-NEXT:     value: Int 1165// CHECK-NEXT:       IntegerLiteral166// CHECK-MODULE:      FieldDecl{{.*}} TestFieldDeclPrivate 'int' __module_private__167 168int TestVarDecl;169// CHECK:      VarDecl{{.*}} TestVarDecl 'int'170 171extern int TestVarDeclSC;172// CHECK:      VarDecl{{.*}} TestVarDeclSC 'int' extern173 174__thread int TestVarDeclThread;175// CHECK:      VarDecl{{.*}} TestVarDeclThread 'int' tls{{$}}176 177__module_private__ int TestVarDeclPrivate;178// CHECK-MODULE:      VarDecl{{.*}} TestVarDeclPrivate 'int' __module_private__179 180int TestVarDeclInit = 0;181// CHECK:      VarDecl{{.*}} TestVarDeclInit 'int'182// CHECK-NEXT:   IntegerLiteral183 184void testParmVarDecl(int TestParmVarDecl);185// CHECK: ParmVarDecl{{.*}} TestParmVarDecl 'int'186 187#ifdef MODULES188#pragma clang module end189#endif190 191