1 // RUN: %clang_cc1 -std=c++11 -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix DECLS %s
2 // RUN: %clang_cc1 -std=c++11 -ast-dump-lookups -ast-dump-filter Test %s | FileCheck -check-prefix LOOKUPS %s
3 // RUN: %clang_cc1 -std=c++11 -ast-dump -ast-dump-lookups -ast-dump-filter Test %s | FileCheck -check-prefix DECLS-LOOKUPS %s
4 // RUN: %clang_cc1 -std=c++11 -DPRAGMA -fsyntax-only %s 2>&1 | FileCheck -check-prefix PRAGMA %s
5 
6 namespace Test {
7   typedef int T;
8   extern int a;
9   int a = 0;
10 }
11 
12 #ifdef PRAGMA
13 #pragma clang __debug dump Test
14 // PRAGMA: lookup results for Test:
15 // PRAGMA-NEXT: NamespaceDecl {{.*}} Test
16 // PRAGMA-NEXT: |-TypedefDecl {{.*}} T 'int'
17 // PRAGMA-NEXT: | `-BuiltinType {{.*}} 'int'
18 // PRAGMA-NEXT: |-VarDecl [[EXTERN_A:0x[^ ]*]] {{.*}} a 'int' extern
19 // PRAGMA-NEXT: `-VarDecl {{.*}} prev [[EXTERN_A]] {{.*}} a 'int' cinit
20 // PRAGMA-NEXT:   `-IntegerLiteral {{.*}} 'int' 0
21 #endif
22 
23 namespace Test { }
24 
25 // DECLS: Dumping Test:
26 // DECLS-NEXT: NamespaceDecl {{.*}} Test
27 // DECLS-NEXT: |-TypedefDecl {{.*}} T 'int'
28 // DECLS-NEXT: | `-BuiltinType {{.*}} 'int'
29 // DECLS-NEXT: |-VarDecl [[EXTERN_A:0x[^ ]*]] {{.*}} a 'int' extern
30 // DECLS-NEXT: `-VarDecl {{.*}} prev [[EXTERN_A]] {{.*}} a 'int' cinit
31 // DECLS-NEXT:   `-IntegerLiteral {{.*}} 'int' 0
32 //
33 // DECLS: Dumping Test:
34 // DECLS-NEXT: NamespaceDecl {{.*}} Test
35 
36 // LOOKUPS: Dumping Test:
37 // LOOKUPS-NEXT: StoredDeclsMap Namespace {{.*}} 'Test'
38 // LOOKUPS:      DeclarationName 'a'
39 // LOOKUPS-NEXT: `-Var {{.*}} 'a' 'int'
40 //
41 // LOOKUPS: Dumping Test:
42 // LOOKUPS-NEXT: Lookup map is in primary DeclContext
43 
44 // DECLS-LOOKUPS: Dumping Test:
45 // DECLS-LOOKUPS-NEXT: StoredDeclsMap Namespace {{.*}} 'Test'
46 // DECLS-LOOKUPS:       -DeclarationName 'a'
47 // DECLS-LOOKUPS-NEXT:   `-Var [[A:[^ ]*]] 'a' 'int'
48 // DECLS-LOOKUPS-NEXT:     |-VarDecl [[EXTERN_A:0x[^ ]*]] {{.*}} a 'int' extern
49 // DECLS-LOOKUPS-NEXT:     `-VarDecl [[A]] prev [[EXTERN_A]] {{.*}} a 'int' cinit
50 // DECLS-LOOKUPS-NEXT:       `-IntegerLiteral {{.*}} 'int' 0
51 //
52 // DECLS-LOOKUPS: Dumping Test:
53 // DECLS-LOOKUPS-NEXT: Lookup map is in primary DeclContext
54