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.c70
1 files changed, 38 insertions, 32 deletions
diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c
index e6bb0869d0b1..45988270f0e6 100644
--- a/test/Index/annotate-tokens-pp.c
+++ b/test/Index/annotate-tokens-pp.c
@@ -28,7 +28,10 @@ void test() {
#include "pragma-once.h"
#include "guarded.h"
-// RUN: c-index-test -test-annotate-tokens=%s:2:1:30:1 -I%S/Inputs %s | FileCheck %s
+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
// 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
@@ -101,45 +104,47 @@ void test() {
// CHECK: Identifier: "test_macro_args" [13:6 - 13:21] FunctionDecl=test_macro_args:13:6 (Definition)
// CHECK: Punctuation: "(" [13:21 - 13:22] FunctionDecl=test_macro_args:13:6 (Definition)
// CHECK: Punctuation: ")" [13:22 - 13:23] FunctionDecl=test_macro_args:13:6 (Definition)
-// CHECK: Punctuation: "{" [13:24 - 13:25] UnexposedStmt=
+// CHECK: Punctuation: "{" [13:24 - 13:25] CompoundStmt=
// CHECK: Keyword: "int" [14:3 - 14:6] VarDecl=z:14:7 (Definition)
// CHECK: Identifier: "z" [14:7 - 14:8] VarDecl=z:14:7 (Definition)
// CHECK: Punctuation: "=" [14:9 - 14:10] VarDecl=z:14:7 (Definition)
-// CHECK: Literal: "1" [14:11 - 14:12] UnexposedExpr=
-// CHECK: Punctuation: ";" [14:12 - 14:13] UnexposedStmt=
+// CHECK: Literal: "1" [14:11 - 14:12] IntegerLiteral=
+// CHECK: Punctuation: ";" [14:12 - 14:13] DeclStmt=
// CHECK: Keyword: "int" [15:3 - 15:6] VarDecl=t:15:7 (Definition)
// CHECK: Identifier: "t" [15:7 - 15:8] VarDecl=t:15:7 (Definition)
// CHECK: Punctuation: "=" [15:9 - 15:10] VarDecl=t:15:7 (Definition)
-// CHECK: Literal: "2" [15:11 - 15:12] UnexposedExpr=
-// CHECK: Punctuation: ";" [15:12 - 15:13] UnexposedStmt=
+// CHECK: Literal: "2" [15:11 - 15:12] IntegerLiteral=
+// CHECK: Punctuation: ";" [15:12 - 15:13] DeclStmt=
// CHECK: Keyword: "int" [16:3 - 16:6] VarDecl=k:16:7 (Definition)
// CHECK: Identifier: "k" [16:7 - 16:8] VarDecl=k:16:7 (Definition)
// CHECK: Punctuation: "=" [16:9 - 16:10] VarDecl=k:16:7 (Definition)
// CHECK: Identifier: "REVERSE_MACRO" [16:11 - 16:24] macro expansion=REVERSE_MACRO:10:9
-// CHECK: Punctuation: "(" [16:24 - 16:25] UnexposedStmt=
+// CHECK: Punctuation: "(" [16:24 - 16:25]
// CHECK: Identifier: "t" [16:25 - 16:26] DeclRefExpr=t:15:7
-// CHECK: Punctuation: "," [16:26 - 16:27] UnexposedStmt=
+// CHECK: Punctuation: "," [16:26 - 16:27]
// CHECK: Identifier: "z" [16:27 - 16:28] DeclRefExpr=z:14:7
-// CHECK: Punctuation: ")" [16:28 - 16:29] UnexposedStmt=
-// CHECK: Punctuation: ";" [16:29 - 16:30] UnexposedStmt=
+// FIXME: The token below should really be annotated as "macro expansion=REVERSE_MACRO:10:9"
+// CHECK: Punctuation: ")" [16:28 - 16:29] VarDecl=k:16:7 (Definition)
+// CHECK: Punctuation: ";" [16:29 - 16:30] DeclStmt=
// CHECK: Keyword: "int" [17:3 - 17:6] VarDecl=j:17:7 (Definition)
// CHECK: Identifier: "j" [17:7 - 17:8] VarDecl=j:17:7 (Definition)
// CHECK: Punctuation: "=" [17:9 - 17:10] VarDecl=j:17:7 (Definition)
// CHECK: Identifier: "TWICE_MACRO" [17:11 - 17:22] macro expansion=TWICE_MACRO:11:9
-// CHECK: Punctuation: "(" [17:22 - 17:23] UnexposedStmt=
+// CHECK: Punctuation: "(" [17:22 - 17:23]
// CHECK: Identifier: "k" [17:23 - 17:24] DeclRefExpr=k:16:7
-// CHECK: Punctuation: "+" [17:25 - 17:26] UnexposedStmt=
+// CHECK: Punctuation: "+" [17:25 - 17:26] BinaryOperator=
// CHECK: Identifier: "k" [17:27 - 17:28] DeclRefExpr=k:16:7
-// CHECK: Punctuation: ")" [17:28 - 17:29] UnexposedStmt=
-// CHECK: Punctuation: ";" [17:29 - 17:30] UnexposedStmt=
+// FIXME: The token below should really be annotated as "macro expansion=TWICE_MACRO:11:9"
+// CHECK: Punctuation: ")" [17:28 - 17:29] VarDecl=j:17:7 (Definition)
+// CHECK: Punctuation: ";" [17:29 - 17:30] DeclStmt=
// CHECK: Keyword: "int" [18:3 - 18:6] VarDecl=w:18:7 (Definition)
// CHECK: Identifier: "w" [18:7 - 18:8] VarDecl=w:18:7 (Definition)
// CHECK: Punctuation: "=" [18:9 - 18:10] VarDecl=w:18:7 (Definition)
// CHECK: Identifier: "j" [18:11 - 18:12] DeclRefExpr=j:17:7
-// CHECK: Punctuation: "+" [18:13 - 18:14] UnexposedExpr=
+// CHECK: Punctuation: "+" [18:13 - 18:14] BinaryOperator=
// CHECK: Identifier: "j" [18:15 - 18:16] DeclRefExpr=j:17:7
-// CHECK: Punctuation: ";" [18:16 - 18:17] UnexposedStmt=
-// CHECK: Punctuation: "}" [19:1 - 19:2] UnexposedStmt=
+// CHECK: Punctuation: ";" [18:16 - 18:17] DeclStmt=
+// CHECK: Punctuation: "}" [19:1 - 19:2] CompoundStmt=
// CHECK: Punctuation: "#" [21:1 - 21:2] preprocessing directive=
// CHECK: Identifier: "define" [21:2 - 21:8] preprocessing directive=
// CHECK: Identifier: "fun_with_macro_bodies" [21:9 - 21:30] macro definition=fun_with_macro_bodies
@@ -164,28 +169,29 @@ void test() {
// CHECK: Identifier: "test" [23:6 - 23:10] FunctionDecl=test:23:6 (Definition)
// CHECK: Punctuation: "(" [23:10 - 23:11] FunctionDecl=test:23:6 (Definition)
// CHECK: Punctuation: ")" [23:11 - 23:12] FunctionDecl=test:23:6 (Definition)
-// CHECK: Punctuation: "{" [23:13 - 23:14] UnexposedStmt=
+// CHECK: Punctuation: "{" [23:13 - 23:14] CompoundStmt=
// CHECK: Keyword: "int" [24:3 - 24:6] VarDecl=x:24:7 (Definition)
// CHECK: Identifier: "x" [24:7 - 24:8] VarDecl=x:24:7 (Definition)
// CHECK: Punctuation: "=" [24:9 - 24:10] VarDecl=x:24:7 (Definition)
-// CHECK: Literal: "10" [24:11 - 24:13] UnexposedExpr=
-// CHECK: Punctuation: ";" [24:13 - 24:14] UnexposedStmt=
+// CHECK: Literal: "10" [24:11 - 24:13] IntegerLiteral=
+// CHECK: Punctuation: ";" [24:13 - 24:14] DeclStmt=
// CHECK: Identifier: "fun_with_macro_bodies" [25:3 - 25:24] macro expansion=fun_with_macro_bodies:21:9
-// CHECK: Punctuation: "(" [25:24 - 25:25] UnexposedStmt=
+// CHECK: Punctuation: "(" [25:24 - 25:25] CompoundStmt=
// CHECK: Identifier: "x" [25:25 - 25:26] DeclRefExpr=x:24:7
-// CHECK: Punctuation: "," [25:26 - 25:27] UnexposedStmt=
-// CHECK: Punctuation: "{" [25:28 - 25:29] UnexposedStmt=
-// CHECK: Keyword: "int" [25:30 - 25:33] UnexposedStmt=
+// CHECK: Punctuation: "," [25:26 - 25:27]
+// CHECK: Punctuation: "{" [25:28 - 25:29] CompoundStmt=
+// CHECK: Keyword: "int" [25:30 - 25:33] DeclStmt=
// CHECK: Identifier: "z" [25:34 - 25:35] VarDecl=z:25:34 (Definition)
-// CHECK: Punctuation: "=" [25:36 - 25:37] UnexposedStmt=
+// CHECK: Punctuation: "=" [25:36 - 25:37] VarDecl=z:25:34 (Definition)
// CHECK: Identifier: "x" [25:38 - 25:39] DeclRefExpr=x:24:7
-// CHECK: Punctuation: ";" [25:39 - 25:40] UnexposedStmt=
-// CHECK: Punctuation: "++" [25:41 - 25:43] UnexposedExpr=
+// CHECK: Punctuation: ";" [25:39 - 25:40] DeclStmt=
+// CHECK: Punctuation: "++" [25:41 - 25:43] UnaryOperator=
// CHECK: Identifier: "z" [25:43 - 25:44] DeclRefExpr=z:25:3
-// CHECK: Punctuation: ";" [25:44 - 25:45] UnexposedStmt=
-// CHECK: Punctuation: "}" [25:46 - 25:47] UnexposedStmt=
-// CHECK: Punctuation: ")" [25:47 - 25:48] UnexposedStmt=
-// CHECK: Punctuation: ";" [25:48 - 25:49] UnexposedStmt=
-// CHECK: Punctuation: "}" [26:1 - 26:2] UnexposedStmt=
+// CHECK: Punctuation: ";" [25:44 - 25:45] CompoundStmt=
+// CHECK: Punctuation: "}" [25:46 - 25:47] CompoundStmt=
+// CHECK: Punctuation: ")" [25:47 - 25:48] DoStmt=
+// CHECK: Punctuation: ";" [25:48 - 25:49] CompoundStmt=
+// CHECK: Punctuation: "}" [26:1 - 26:2] CompoundStmt=
// 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__