xref: /minix3/external/bsd/llvm/dist/clang/test/Index/load-namespaces.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test is line- and column-sensitive; see below.
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc namespace std {
4*f4a2713aSLionel Sambuc   namespace rel_ops {
5*f4a2713aSLionel Sambuc     void f();
6*f4a2713aSLionel Sambuc   }
7*f4a2713aSLionel Sambuc }
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc namespace std {
10*f4a2713aSLionel Sambuc   void g();
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc namespace std98 = std;
14*f4a2713aSLionel Sambuc namespace std0x = std98;
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc using namespace std0x;
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc namespace std {
19*f4a2713aSLionel Sambuc   int g(int);
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc using std::g;
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc void std::g() {
25*f4a2713aSLionel Sambuc }
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc namespace my_rel_ops = std::rel_ops;
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc // RUN: c-index-test -test-load-source all %s | FileCheck %s
30*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:3:11: Namespace=std:3:11 (Definition) Extent=[3:1 - 7:2]
31*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:4:13: Namespace=rel_ops:4:13 (Definition) Extent=[4:3 - 6:4]
32*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:5:10: FunctionDecl=f:5:10 Extent=[5:5 - 5:13]
33*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:9:11: Namespace=std:9:11 (Definition) Extent=[9:1 - 11:2]
34*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:10:8: FunctionDecl=g:10:8 Extent=[10:3 - 10:11]
35*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:13:11: NamespaceAlias=std98:13:11 Extent=[13:1 - 13:22]
36*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:13:19: NamespaceRef=std:3:11 Extent=[13:19 - 13:22]
37*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:14:11: NamespaceAlias=std0x:14:11 Extent=[14:1 - 14:24]
38*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:14:19: NamespaceRef=std98:13:11 Extent=[14:19 - 14:24]
39*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:16:17: UsingDirective=:16:17 Extent=[16:1 - 16:22]
40*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:16:17: NamespaceRef=std0x:14:11 Extent=[16:17 - 16:22]
41*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:18:11: Namespace=std:18:11 (Definition) Extent=[18:1 - 20:2]
42*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:3 - 19:13]
43*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:19:12: ParmDecl=:19:12 (Definition) Extent=[19:9 - 19:13]
44*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g[19:7, 10:8] Extent=[22:1 - 22:13]
45*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:22:7: NamespaceRef=std:18:11 Extent=[22:7 - 22:10]
46*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:1 - 25:2]
47*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:24:6: NamespaceRef=std:18:11 Extent=[24:6 - 24:9]
48*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:27:11: NamespaceAlias=my_rel_ops:27:11 Extent=[27:1 - 27:36]
49*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:27:24: NamespaceRef=std:18:11 Extent=[27:24 - 27:27]
50*f4a2713aSLionel Sambuc // CHECK: load-namespaces.cpp:27:29: NamespaceRef=rel_ops:4:13 Extent=[27:29 - 27:36]
51