[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / ast-dump-lookups.cpp
blob2d235010cb735e32970c6ed0f6045b5e135b7bce
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
6 namespace Test {
7 typedef int T;
8 extern int a;
9 int a = 0;
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
23 namespace Test { }
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
33 // DECLS: Dumping Test:
34 // DECLS-NEXT: NamespaceDecl {{.*}} Test
36 // LOOKUPS: Dumping Test:
37 // LOOKUPS-NEXT: StoredDeclsMap Namespace {{.*}} 'Test'
38 // LOOKUPS: DeclarationName 'a'
39 // LOOKUPS-NEXT: `-Var {{.*}} 'a' 'int'
41 // LOOKUPS: Dumping Test:
42 // LOOKUPS-NEXT: Lookup map is in primary DeclContext
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
52 // DECLS-LOOKUPS: Dumping Test:
53 // DECLS-LOOKUPS-NEXT: Lookup map is in primary DeclContext