Raphael Isemann | 4e4c066 | 2019-01-21 10:14:31 +0000 | [diff] [blame] | 1 | // RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s |
| 2 | |
| 3 | // The implicit UsingDirectiveDecls for the anonymous namespaces are created by the Sema. |
| 4 | |
Raphael Isemann | ed5a897 | 2019-10-01 11:53:20 +0000 | [diff] [blame] | 5 | // There might be another builtin namespace before our first namespace, so we can't |
| 6 | // just look for NamespaceDecl. Instead look for the first line of F.cpp (which only |
| 7 | // contains the namespace we are looking for but no other decl). |
| 8 | // CHECK: F.cpp:1:1 |
Raphael Isemann | 4e4c066 | 2019-01-21 10:14:31 +0000 | [diff] [blame] | 9 | // The nested anonymous namespace. |
| 10 | // CHECK-NEXT: NamespaceDecl |
Balázs Kéri | a9f10eb | 2019-12-05 16:21:21 +0100 | [diff] [blame] | 11 | // CHECK-SAME: line:21:11 |
Raphael Isemann | 4e4c066 | 2019-01-21 10:14:31 +0000 | [diff] [blame] | 12 | // CHECK: FunctionDecl |
| 13 | // CHECK-SAME: func4 |
| 14 | // CHECK-NEXT: CompoundStmt |
| 15 | // This is for the nested anonymous namespace. |
| 16 | // CHECK-NEXT: UsingDirectiveDecl |
| 17 | // CHECK-SAME: '' |
| 18 | // CHECK: FunctionDecl |
| 19 | // CHECK-SAME: func1 |
| 20 | // CHECK-NEXT: CompoundStmt |
| 21 | // CHECK-NEXT: UsingDirectiveDecl |
| 22 | // CHECK-SAME: '' |
| 23 | |
| 24 | // CHECK: NamespaceDecl |
| 25 | // CHECK-SAME: test_namespace1 |
| 26 | // CHECK-NEXT: NamespaceDecl |
| 27 | // CHECK: FunctionDecl |
| 28 | // CHECK-SAME: func2 |
| 29 | // CHECK-NEXT: CompoundStmt |
| 30 | // CHECK-NEXT: UsingDirectiveDecl |
| 31 | // CHECK-SAME: '' |
| 32 | |
| 33 | // CHECK-NEXT: NamespaceDecl |
| 34 | // CHECK-SAME: test_namespace2 |
| 35 | // CHECK-NEXT: NamespaceDecl |
| 36 | // CHECK-NEXT: NamespaceDecl |
| 37 | // CHECK-SAME: test_namespace3 |
| 38 | // CHECK: FunctionDecl |
| 39 | // CHECK-SAME: func3 |
| 40 | // CHECK-NEXT: CompoundStmt |
| 41 | // CHECK-NEXT: UsingDirectiveDecl |
| 42 | // CHECK-SAME: '' |
| 43 | |
| 44 | void expr() { |
| 45 | func1(); |
| 46 | test_namespace1::func2(); |
| 47 | test_namespace2::test_namespace3::func3(); |
| 48 | func4(); |
| 49 | } |