aboutsummaryrefslogtreecommitdiff
path: root/test/Index/annotate-nested-name-specifier.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-25 00:36:19 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-25 00:36:19 +0000
commitdc355713be51fcb4ee52d9fd6b4548ceff47fadf (patch)
treeeb1eee27bd2a2ddf32d520822adef83d7e982890 /test/Index/annotate-nested-name-specifier.cpp
parent670d6ed9f058526af4c07724f7da50139e252a22 (diff)
Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the extremely-lossy NestedNameSpecifier/SourceRange pair it used to use, improving source-location information. Various infrastructure updates to support NestedNameSpecifierLoc: - AST/PCH (de-)serialization - Recursive AST visitor - libclang traversal (including the first tests of this functionality) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/annotate-nested-name-specifier.cpp')
-rw-r--r--test/Index/annotate-nested-name-specifier.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/Index/annotate-nested-name-specifier.cpp b/test/Index/annotate-nested-name-specifier.cpp
new file mode 100644
index 0000000000..13bcc98db5
--- /dev/null
+++ b/test/Index/annotate-nested-name-specifier.cpp
@@ -0,0 +1,42 @@
+namespace outer {
+ namespace inner {
+ template<typename T>
+ struct vector {
+ typedef T* iterator;
+ };
+ }
+}
+
+namespace outer_alias = outer;
+
+struct X { };
+
+using outer_alias::inner::vector;
+
+struct X_vector : outer_alias::inner::vector<X> {
+ using outer_alias::inner::vector<X>::iterator;
+};
+
+
+
+// RUN: c-index-test -test-annotate-tokens=%s:13:1:19:1 %s | FileCheck %s
+
+// CHECK: Keyword: "using" [14:1 - 14:6] UsingDeclaration=vector[4:12]
+// CHECK: Identifier: "outer_alias" [14:7 - 14:18] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [14:18 - 14:20] UsingDeclaration=vector[4:12]
+// CHECK: Identifier: "inner" [14:20 - 14:25] NamespaceRef=inner:2:13
+// CHECK: Punctuation: "::" [14:25 - 14:27] UsingDeclaration=vector[4:12]
+// CHECK: Identifier: "vector" [14:27 - 14:33] OverloadedDeclRef=vector[4:12]
+// CHECK: Punctuation: ";" [14:33 - 14:34]
+// FIXME: Base specifiers, too
+// CHECK: Keyword: "using" [17:3 - 17:8] UsingDeclaration=iterator[5:18]
+// CHECK: Identifier: "outer_alias" [17:9 - 17:20] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [17:20 - 17:22] UsingDeclaration=iterator[5:18]
+// CHECK: Identifier: "inner" [17:22 - 17:27] NamespaceRef=inner:2:13
+// CHECK: Punctuation: "::" [17:27 - 17:29] UsingDeclaration=iterator[5:18]
+// CHECK: Identifier: "vector" [17:29 - 17:35] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [17:35 - 17:36] UsingDeclaration=iterator[5:18]
+// CHECK: Identifier: "X" [17:36 - 17:37] TypeRef=struct X:12:8
+// CHECK: Punctuation: ">" [17:37 - 17:38] UsingDeclaration=iterator[5:18]
+// CHECK: Punctuation: "::" [17:38 - 17:40] UsingDeclaration=iterator[5:18]
+// CHECK: Identifier: "iterator" [17:40 - 17:48] OverloadedDeclRef=iterator[5:18]