diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-18 00:42:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-18 00:42:48 +0000 |
commit | 9f1e3ff3b3095967e2b92b57a53524e2d6bb141c (patch) | |
tree | 28b9b4d3d754c3c581a84bb25180ed8149271a45 /test/Index/annotate-tokens-pp.c | |
parent | 5e454aa4c9249693ec69be05e16081c9b7a48dc7 (diff) |
Experimental stab at using relexing to identify preprocessor
directives while annotating tokens in CIndex. This functionality
should probably be factored out of this routine, but we're not there
yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/annotate-tokens-pp.c')
-rw-r--r-- | test/Index/annotate-tokens-pp.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c new file mode 100644 index 0000000000..32481fe0f0 --- /dev/null +++ b/test/Index/annotate-tokens-pp.c @@ -0,0 +1,31 @@ +#define BAR baz +#define WIBBLE(X, Y) +WIBBLE(int, float) +int BAR; +#include "foo.h" + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:6:1 -I%S/Inputs %s | FileCheck %s +// CHECK: Punctuation: "#" [1:1 - 1:2] preprocessing directive= +// CHECK: Identifier: "define" [1:2 - 1:8] preprocessing directive= +// CHECK: Identifier: "BAR" [1:9 - 1:12] preprocessing directive= +// CHECK: Identifier: "baz" [1:13 - 1:16] preprocessing directive= +// CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive= +// CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive= +// CHECK: Identifier: "WIBBLE" [2:9 - 2:15] preprocessing directive= +// CHECK: Punctuation: "(" [2:15 - 2:16] preprocessing directive= +// CHECK: Identifier: "X" [2:16 - 2:17] preprocessing directive= +// CHECK: Punctuation: "," [2:17 - 2:18] preprocessing directive= +// CHECK: Identifier: "Y" [2:19 - 2:20] preprocessing directive= +// CHECK: Punctuation: ")" [2:20 - 2:21] preprocessing directive= +// CHECK: Identifier: "WIBBLE" [3:1 - 3:7] +// CHECK: Punctuation: "(" [3:7 - 3:8] +// CHECK: Keyword: "int" [3:8 - 3:11] +// CHECK: Punctuation: "," [3:11 - 3:12] +// CHECK: Keyword: "float" [3:13 - 3:18] +// CHECK: Punctuation: ")" [3:18 - 3:19] +// CHECK: Keyword: "int" [4:1 - 4:4] +// CHECK: Identifier: "BAR" [4:5 - 4:8] +// CHECK: Punctuation: ";" [4:8 - 4:9] +// CHECK: Punctuation: "#" [5:1 - 5:2] preprocessing directive= +// CHECK: Identifier: "include" [5:2 - 5:9] preprocessing directive= +// CHECK: Literal: ""foo.h"" [5:10 - 5:17] preprocessing directive= |