aboutsummaryrefslogtreecommitdiff
path: root/test/Index/annotate-tokens-preamble.c
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-26 08:01:41 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-26 08:01:41 +0000
commitee0f84fc84ed7de7975e102668d8e53a778f7a8c (patch)
tree8b93a515c07f1806207d85a1517c45b4d3aed9cd /test/Index/annotate-tokens-preamble.c
parent7e7b503211f1c0ae1537da4657c9ed34f69b3506 (diff)
Don't map a file:line:col triplet that is inside the preamble range to
a "loaded" location of the precompiled preamble. Instead, handle specially locations of preprocessed entities: -When looking up for preprocessed entities, map main file locations inside the preamble range to a preamble loaded location. -When getting the source range of a preprocessing cursor, map preamble loaded locations back to main file locations. Fixes rdar://10175093 & http://llvm.org/PR10999 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140519 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/annotate-tokens-preamble.c')
-rw-r--r--test/Index/annotate-tokens-preamble.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Index/annotate-tokens-preamble.c b/test/Index/annotate-tokens-preamble.c
new file mode 100644
index 0000000000..afac87a77a
--- /dev/null
+++ b/test/Index/annotate-tokens-preamble.c
@@ -0,0 +1,20 @@
+// A comment line.
+
+void f(void *ptr) {
+}
+
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 %s | FileCheck %s
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:1:1:5:1 %s | FileCheck %s
+// CHECK: Comment: "// A comment line." [1:1 - 1:19]
+// CHECK: Keyword: "void" [3:1 - 3:5] FunctionDecl=f:3:6 (Definition)
+// CHECK: Identifier: "f" [3:6 - 3:7] FunctionDecl=f:3:6 (Definition)
+// CHECK: Punctuation: "(" [3:7 - 3:8] FunctionDecl=f:3:6 (Definition)
+// CHECK: Keyword: "void" [3:8 - 3:12] ParmDecl=ptr:3:14 (Definition)
+// CHECK: Punctuation: "*" [3:13 - 3:14] ParmDecl=ptr:3:14 (Definition)
+// CHECK: Identifier: "ptr" [3:14 - 3:17] ParmDecl=ptr:3:14 (Definition)
+// CHECK: Punctuation: ")" [3:17 - 3:18] FunctionDecl=f:3:6 (Definition)
+// CHECK: Punctuation: "{" [3:19 - 3:20] UnexposedStmt=
+// CHECK: Punctuation: "}" [4:1 - 4:2] UnexposedStmt=
+
+