aboutsummaryrefslogtreecommitdiff
path: root/test/Index/annotate-tokens-pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Index/annotate-tokens-pp.c')
-rw-r--r--test/Index/annotate-tokens-pp.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c
index b37ab39eeaff..7da2d6f5823a 100644
--- a/test/Index/annotate-tokens-pp.c
+++ b/test/Index/annotate-tokens-pp.c
@@ -30,12 +30,24 @@ void test() {
const char *fname = __FILE__;
-// RUN: c-index-test -test-annotate-tokens=%s:2:1:32:1 -I%S/Inputs %s | FileCheck %s
-// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:32:1 -I%S/Inputs %s | FileCheck %s
+#define SOME_MACRO 3
+
+#ifdef SOME_MACRO
+#endif
+
+struct A
+{
+#ifdef SOME_MACRO
+ int x;
+#endif
+};
+
+// RUN: c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs %s | FileCheck %s
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:44:1 -I%S/Inputs %s | FileCheck %s
// CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive=
// CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive=
// CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING
-// CHECK: Identifier: "NOTHING" [2:23 - 2:30] macro definition=STILL_NOTHING
+// CHECK: Identifier: "NOTHING" [2:23 - 2:30] macro expansion=NOTHING:1:9
// CHECK: Punctuation: "(" [2:30 - 2:31] macro definition=STILL_NOTHING
// CHECK: Identifier: "honk" [2:31 - 2:35] macro definition=STILL_NOTHING
// CHECK: Punctuation: "," [2:35 - 2:36] macro definition=STILL_NOTHING
@@ -180,7 +192,7 @@ const char *fname = __FILE__;
// CHECK: Identifier: "x" [25:25 - 25:26] DeclRefExpr=x:24:7
// CHECK: Punctuation: "," [25:26 - 25:27]
// CHECK: Punctuation: "{" [25:28 - 25:29] CompoundStmt=
-// CHECK: Keyword: "int" [25:30 - 25:33] DeclStmt=
+// CHECK: Keyword: "int" [25:30 - 25:33] VarDecl=z:25:34 (Definition)
// CHECK: Identifier: "z" [25:34 - 25:35] VarDecl=z:25:34 (Definition)
// CHECK: Punctuation: "=" [25:36 - 25:37] VarDecl=z:25:34 (Definition)
// CHECK: Identifier: "x" [25:38 - 25:39] DeclRefExpr=x:24:7
@@ -196,3 +208,20 @@ const char *fname = __FILE__;
// CHECK: {{28:1.*inclusion directive=pragma-once.h.*multi-include guarded}}
// CHECK: {{29:1.*inclusion directive=guarded.h.*multi-include guarded}}
// CHECK: Identifier: "__FILE__" [31:21 - 31:29] macro expansion=__FILE__
+// CHECK: Punctuation: "#" [35:1 - 35:2] preprocessing directive=
+// CHECK: Identifier: "ifdef" [35:2 - 35:7] preprocessing directive=
+// CHECK: Identifier: "SOME_MACRO" [35:8 - 35:18] macro expansion=SOME_MACRO:33:9
+// CHECK: Punctuation: "#" [36:1 - 36:2] preprocessing directive=
+// CHECK: Identifier: "endif" [36:2 - 36:7] preprocessing directive=
+// CHECK: Keyword: "struct" [38:1 - 38:7] StructDecl=A:38:8 (Definition)
+// CHECK: Identifier: "A" [38:8 - 38:9] StructDecl=A:38:8 (Definition)
+// CHECK: Punctuation: "{" [39:1 - 39:2] StructDecl=A:38:8 (Definition)
+// CHECK: Punctuation: "#" [40:1 - 40:2] preprocessing directive=
+// CHECK: Identifier: "ifdef" [40:2 - 40:7] preprocessing directive=
+// CHECK: Identifier: "SOME_MACRO" [40:8 - 40:18] macro expansion=SOME_MACRO:33:9
+// CHECK: Keyword: "int" [41:3 - 41:6] FieldDecl=x:41:7 (Definition)
+// CHECK: Identifier: "x" [41:7 - 41:8] FieldDecl=x:41:7 (Definition)
+// CHECK: Punctuation: ";" [41:8 - 41:9] StructDecl=A:38:8 (Definition)
+// CHECK: Punctuation: "#" [42:1 - 42:2] preprocessing directive=
+// CHECK: Identifier: "endif" [42:2 - 42:7] preprocessing directive=
+// CHECK: Punctuation: "}" [43:1 - 43:2] StructDecl=A:38:8 (Definition)