ast-dump-lookups.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. namespace Test {
  5. extern int a;
  6. int a = 0;
  7. }
  8. namespace Test { }
  9. // DECLS: Dumping Test:
  10. // DECLS-NEXT: NamespaceDecl {{.*}} Test
  11. // DECLS-NEXT: |-VarDecl [[EXTERN_A:0x[^ ]*]] {{.*}} a 'int' extern
  12. // DECLS-NEXT: `-VarDecl {{.*}} prev [[EXTERN_A]] {{.*}} a 'int' cinit
  13. // DECLS-NEXT: `-IntegerLiteral {{.*}} 'int' 0
  14. //
  15. // DECLS: Dumping Test:
  16. // DECLS-NEXT: NamespaceDecl {{.*}} Test
  17. // LOOKUPS: Dumping Test:
  18. // LOOKUPS-NEXT: StoredDeclsMap Namespace {{.*}} 'Test'
  19. // LOOKUPS-NEXT: `-DeclarationName 'a'
  20. // LOOKUPS-NEXT: `-Var {{.*}} 'a' 'int'
  21. //
  22. // LOOKUPS: Dumping Test:
  23. // LOOKUPS-NEXT: Lookup map is in primary DeclContext
  24. // DECLS-LOOKUPS: Dumping Test:
  25. // DECLS-LOOKUPS-NEXT: StoredDeclsMap Namespace {{.*}} 'Test'
  26. // DECLS-LOOKUPS-NEXT: `-DeclarationName 'a'
  27. // DECLS-LOOKUPS-NEXT: `-Var [[A:[^ ]*]] 'a' 'int'
  28. // DECLS-LOOKUPS-NEXT: |-VarDecl [[EXTERN_A:0x[^ ]*]] {{.*}} a 'int' extern
  29. // DECLS-LOOKUPS-NEXT: `-VarDecl [[A]] prev [[EXTERN_A]] {{.*}} a 'int' cinit
  30. // DECLS-LOOKUPS-NEXT: `-IntegerLiteral {{.*}} 'int' 0
  31. //
  32. // DECLS-LOOKUPS: Dumping Test:
  33. // DECLS-LOOKUPS-NEXT: Lookup map is in primary DeclContext