12f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s
22f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -check-prefix CHECK-TU -strict-whitespace %s
32f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
42f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianint TestLocation;
52f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK: VarDecl 0x{{[^ ]*}} <{{.*}}:4:1, col:5> col:5 TestLocation
62f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
72f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestIndent {
82f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  int x;
92f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
102f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      {{^}}RecordDecl{{.*TestIndent[^()]*$}}
112f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT: {{^}}`-FieldDecl{{.*x[^()]*$}}
122f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
132f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestChildren {
142f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  int x;
152f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  struct y {
162f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian    int z;
172f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  };
182f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
192f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}}TestChildren
202f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   FieldDecl{{.*}}x
212f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   RecordDecl{{.*}}y
222f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:     FieldDecl{{.*}}z
232f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
242f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-TU: TranslationUnitDecl
252f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
262f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianvoid testLabelDecl() {
272f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  __label__ TestLabelDecl;
282f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  TestLabelDecl: goto TestLabelDecl;
292f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian}
302f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      LabelDecl{{.*}} TestLabelDecl
312f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
322f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfaniantypedef int TestTypedefDecl;
332f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      TypedefDecl{{.*}} TestTypedefDecl 'int'
342f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
352f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian__module_private__ typedef int TestTypedefDeclPrivate;
362f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      TypedefDecl{{.*}} TestTypedefDeclPrivate 'int' __module_private__
372f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
382f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianenum TestEnumDecl {
392f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  testEnumDecl
402f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
412f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      EnumDecl{{.*}} TestEnumDecl
422f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   EnumConstantDecl{{.*}} testEnumDecl
432f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
442f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestEnumDeclAnon {
452f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  enum {
462f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian    testEnumDeclAnon
472f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  } e;
482f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
492f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} TestEnumDeclAnon
502f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   EnumDecl{{.*> .*$}}
512f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
522f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianenum TestEnumDeclForward;
532f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      EnumDecl{{.*}} TestEnumDeclForward
542f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
552f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian__module_private__ enum TestEnumDeclPrivate;
562f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      EnumDecl{{.*}} TestEnumDeclPrivate __module_private__
572f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
582f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestRecordDecl {
592f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  int i;
602f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
612f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} struct TestRecordDecl
622f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   FieldDecl
632f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
642f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestRecordDeclEmpty {
652f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
662f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} struct TestRecordDeclEmpty
672f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
682f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestRecordDeclAnon1 {
692f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  struct {
702f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  } testRecordDeclAnon1;
712f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
722f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} struct TestRecordDeclAnon1
732f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   RecordDecl{{.*}} struct
742f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
752f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestRecordDeclAnon2 {
762f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  struct {
772f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  };
782f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
792f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} struct TestRecordDeclAnon2
802f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   RecordDecl{{.*}} struct
812f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
822f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct TestRecordDeclForward;
832f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} struct TestRecordDeclForward
842f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
852f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian__module_private__ struct TestRecordDeclPrivate;
862f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      RecordDecl{{.*}} struct TestRecordDeclPrivate __module_private__
872f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
882f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianenum testEnumConstantDecl {
892f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  TestEnumConstantDecl,
902f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  TestEnumConstantDeclInit = 1
912f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
922f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      EnumConstantDecl{{.*}} TestEnumConstantDecl 'int'
932f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      EnumConstantDecl{{.*}} TestEnumConstantDeclInit 'int'
942f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   IntegerLiteral
952f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
962f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct testIndirectFieldDecl {
972f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  struct {
982f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian    int TestIndirectFieldDecl;
992f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  };
1002f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
1012f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      IndirectFieldDecl{{.*}} TestIndirectFieldDecl 'int'
1022f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   Field{{.*}} ''
1032f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   Field{{.*}} 'TestIndirectFieldDecl'
1042f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1052f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianint TestFunctionDecl(int x, enum { e } y) {
1062f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  return x;
1072f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian}
1082f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      FunctionDecl{{.*}} TestFunctionDecl 'int (int, enum {{.*}})'
1092f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   EnumDecl
1102f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:     EnumConstantDecl{{.*}} e
1112f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   ParmVarDecl{{.*}} x
1122f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   ParmVarDecl{{.*}} y
1132f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   CompoundStmt
1142f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1152f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianint TestFunctionDeclProto(int x);
1162f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      FunctionDecl{{.*}} TestFunctionDeclProto 'int (int)'
1172f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   ParmVarDecl{{.*}} x
1182f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1192f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianextern int TestFunctionDeclSC();
1202f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      FunctionDecl{{.*}} TestFunctionDeclSC 'int ()' extern
1212f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1222f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianinline int TestFunctionDeclInline();
1232f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      FunctionDecl{{.*}} TestFunctionDeclInline 'int ()' inline
1242f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1252f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianstruct testFieldDecl {
1262f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  int TestFieldDecl;
1272f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  int TestFieldDeclWidth : 1;
1282f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  __module_private__ int TestFieldDeclPrivate;
1292f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian};
13010ae593a59aa50963e1d3159747da2d65ca79bedEric Erfanian// CHECK:      FieldDecl{{.*}} TestFieldDecl 'int'
13110ae593a59aa50963e1d3159747da2d65ca79bedEric Erfanian// CHECK:      FieldDecl{{.*}} TestFieldDeclWidth 'int'
1322f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   IntegerLiteral
1332f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      FieldDecl{{.*}} TestFieldDeclPrivate 'int' __module_private__
1342f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1352f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianint TestVarDecl;
1362f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      VarDecl{{.*}} TestVarDecl 'int'
1372f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1382f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianextern int TestVarDeclSC;
1392f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      VarDecl{{.*}} TestVarDeclSC 'int' extern
1402f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1412f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian__thread int TestVarDeclThread;
1422f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      VarDecl{{.*}} TestVarDeclThread 'int' tls{{$}}
1432f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1442f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian__module_private__ int TestVarDeclPrivate;
1452f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      VarDecl{{.*}} TestVarDeclPrivate 'int' __module_private__
1462f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1472f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianint TestVarDeclInit = 0;
1482f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK:      VarDecl{{.*}} TestVarDeclInit 'int'
1492f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK-NEXT:   IntegerLiteral
1502f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
1512f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianvoid testParmVarDecl(int TestParmVarDecl);
1522f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian// CHECK: ParmVarDecl{{.*}} TestParmVarDecl 'int'
1532f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian