test.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
  2. // The implicit UsingDirectiveDecls for the anonymous namespaces are created by the Sema.
  3. // There might be another builtin namespace before our first namespace, so we can't
  4. // just look for NamespaceDecl. Instead look for the first line of F.cpp (which only
  5. // contains the namespace we are looking for but no other decl).
  6. // CHECK: F.cpp:1:1
  7. // The nested anonymous namespace.
  8. // CHECK-NEXT: NamespaceDecl
  9. // CHECK-SAME: <invalid sloc>
  10. // CHECK: FunctionDecl
  11. // CHECK-SAME: func4
  12. // CHECK-NEXT: CompoundStmt
  13. // This is for the nested anonymous namespace.
  14. // CHECK-NEXT: UsingDirectiveDecl
  15. // CHECK-SAME: ''
  16. // CHECK: FunctionDecl
  17. // CHECK-SAME: func1
  18. // CHECK-NEXT: CompoundStmt
  19. // CHECK-NEXT: UsingDirectiveDecl
  20. // CHECK-SAME: ''
  21. // CHECK: NamespaceDecl
  22. // CHECK-SAME: test_namespace1
  23. // CHECK-NEXT: NamespaceDecl
  24. // CHECK: FunctionDecl
  25. // CHECK-SAME: func2
  26. // CHECK-NEXT: CompoundStmt
  27. // CHECK-NEXT: UsingDirectiveDecl
  28. // CHECK-SAME: ''
  29. // CHECK-NEXT: NamespaceDecl
  30. // CHECK-SAME: test_namespace2
  31. // CHECK-NEXT: NamespaceDecl
  32. // CHECK-NEXT: NamespaceDecl
  33. // CHECK-SAME: test_namespace3
  34. // CHECK: FunctionDecl
  35. // CHECK-SAME: func3
  36. // CHECK-NEXT: CompoundStmt
  37. // CHECK-NEXT: UsingDirectiveDecl
  38. // CHECK-SAME: ''
  39. void expr() {
  40. func1();
  41. test_namespace1::func2();
  42. test_namespace2::test_namespace3::func3();
  43. func4();
  44. }