blob: 485786e1c4e8de06e29dde0ca6559e0e2be2cb99 [file] [log] [blame]
Douglas Gregor4ae8f292010-03-18 17:52:52 +00001#define NOTHING(X,Y)
2#define STILL_NOTHING NOTHING(honk,warble)
Douglas Gregor9f1e3ff2010-03-18 00:42:48 +00003#define BAR baz
Douglas Gregor48072312010-03-18 15:23:44 +00004#define WIBBLE(X, Y) X##Y
Douglas Gregor4ae8f292010-03-18 17:52:52 +00005NOTHING(more,junk) float WIBBLE(int, float);
6int BAR STILL_NOTHING;
Douglas Gregor9f1e3ff2010-03-18 00:42:48 +00007#include "foo.h"
Douglas Gregor4ae8f292010-03-18 17:52:52 +00008#undef BAR
Douglas Gregor9f1e3ff2010-03-18 00:42:48 +00009
Douglas Gregor4ae8f292010-03-18 17:52:52 +000010// RUN: c-index-test -test-annotate-tokens=%s:2:1:9:1 -I%S/Inputs %s | FileCheck %s
Douglas Gregor9f1e3ff2010-03-18 00:42:48 +000011// CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive=
12// CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive=
Douglas Gregor572feb22010-03-18 18:04:21 +000013// CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING
Douglas Gregor4ae8f292010-03-18 17:52:52 +000014// CHECK: Identifier: "NOTHING" [2:23 - 2:30] preprocessing directive=
15// CHECK: Punctuation: "(" [2:30 - 2:31] preprocessing directive=
16// CHECK: Identifier: "honk" [2:31 - 2:35] preprocessing directive=
17// CHECK: Punctuation: "," [2:35 - 2:36] preprocessing directive=
18// CHECK: Identifier: "warble" [2:36 - 2:42] preprocessing directive=
Douglas Gregor3c266842010-03-18 21:28:30 +000019// CHECK: Punctuation: ")" [2:42 - 2:43] preprocessing directive=
Douglas Gregor4ae8f292010-03-18 17:52:52 +000020// CHECK: Punctuation: "#" [3:1 - 3:2] preprocessing directive=
21// CHECK: Identifier: "define" [3:2 - 3:8] preprocessing directive=
Douglas Gregor572feb22010-03-18 18:04:21 +000022// CHECK: Identifier: "BAR" [3:9 - 3:12] macro definition=BAR
Douglas Gregor4ae8f292010-03-18 17:52:52 +000023// CHECK: Identifier: "baz" [3:13 - 3:16] preprocessing directive=
24// CHECK: Punctuation: "#" [4:1 - 4:2] preprocessing directive=
25// CHECK: Identifier: "define" [4:2 - 4:8] preprocessing directive=
Douglas Gregor572feb22010-03-18 18:04:21 +000026// CHECK: Identifier: "WIBBLE" [4:9 - 4:15] macro definition=WIBBLE
Douglas Gregor4ae8f292010-03-18 17:52:52 +000027// CHECK: Punctuation: "(" [4:15 - 4:16] preprocessing directive=
28// CHECK: Identifier: "X" [4:16 - 4:17] preprocessing directive=
29// CHECK: Punctuation: "," [4:17 - 4:18] preprocessing directive=
30// CHECK: Identifier: "Y" [4:19 - 4:20] preprocessing directive=
31// CHECK: Punctuation: ")" [4:20 - 4:21] preprocessing directive=
32// CHECK: Identifier: "X" [4:22 - 4:23] preprocessing directive=
33// CHECK: Punctuation: "##" [4:23 - 4:25] preprocessing directive=
34// CHECK: Identifier: "Y" [4:25 - 4:26] preprocessing directive=
Douglas Gregorbf7efa22010-03-18 18:23:03 +000035// CHECK: Identifier: "NOTHING" [5:1 - 5:8] macro instantiation=NOTHING:1:9
Douglas Gregor4ae8f292010-03-18 17:52:52 +000036// CHECK: Punctuation: "(" [5:8 - 5:9]
37// CHECK: Identifier: "more" [5:9 - 5:13]
38// CHECK: Punctuation: "," [5:13 - 5:14]
39// CHECK: Identifier: "junk" [5:14 - 5:18]
40// CHECK: Punctuation: ")" [5:18 - 5:19]
41// CHECK: Keyword: "float" [5:20 - 5:25]
Douglas Gregorbf7efa22010-03-18 18:23:03 +000042// CHECK: Identifier: "WIBBLE" [5:26 - 5:32] macro instantiation=WIBBLE:4:9
Douglas Gregor4ae8f292010-03-18 17:52:52 +000043// CHECK: Punctuation: "(" [5:32 - 5:33]
44// CHECK: Keyword: "int" [5:33 - 5:36]
45// CHECK: Punctuation: "," [5:36 - 5:37]
46// CHECK: Keyword: "float" [5:38 - 5:43]
47// CHECK: Punctuation: ")" [5:43 - 5:44]
48// CHECK: Punctuation: ";" [5:44 - 5:45]
49// CHECK: Keyword: "int" [6:1 - 6:4]
Douglas Gregorbf7efa22010-03-18 18:23:03 +000050// CHECK: Identifier: "BAR" [6:5 - 6:8] macro instantiation=BAR:3:9
51// CHECK: Identifier: "STILL_NOTHING" [6:9 - 6:22] macro instantiation=STILL_NOTHING:2:9
Douglas Gregor4ae8f292010-03-18 17:52:52 +000052// CHECK: Punctuation: ";" [6:22 - 6:23]
53// CHECK: Punctuation: "#" [7:1 - 7:2] preprocessing directive=
54// CHECK: Identifier: "include" [7:2 - 7:9] preprocessing directive=
55// CHECK: Literal: ""foo.h"" [7:10 - 7:17] preprocessing directive=
56// CHECK: Punctuation: "#" [8:1 - 8:2] preprocessing directive=
57// CHECK: Identifier: "undef" [8:2 - 8:7] preprocessing directive=
58// CHECK: Identifier: "BAR" [8:8 - 8:11] preprocessing directive=