annotate-tokens-pp.c revision 1a1f85a9352cfad7035861a2c1bb92ac62e6e9cb
1#define NOTHING(X,Y) 2#define STILL_NOTHING NOTHING(honk,warble) 3#define BAR baz 4#define WIBBLE(X, Y) X##Y 5NOTHING(more,junk) float WIBBLE(int, float); 6int BAR STILL_NOTHING; 7#include "foo.h" 8#undef BAR 9 10// RUN: c-index-test -test-annotate-tokens=%s:2:1:9:1 -I%S/Inputs %s | FileCheck %s 11// CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive= 12// CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive= 13// CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING 14// 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= 19// CHECK: Punctuation: ")" [2:42 - 2:43] preprocesggsing directive= 20// CHECK: Punctuation: "#" [3:1 - 3:2] preprocessing directive= 21// CHECK: Identifier: "define" [3:2 - 3:8] preprocessing directive= 22// CHECK: Identifier: "BAR" [3:9 - 3:12] macro definition=BAR 23// 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= 26// CHECK: Identifier: "WIBBLE" [4:9 - 4:15] macro definition=WIBBLE 27// 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= 35// CHECK: Identifier: "NOTHING" [5:1 - 5:8] macro instantiation=NOTHING:1:9 36// 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] 42// CHECK: Identifier: "WIBBLE" [5:26 - 5:32] macro instantiation=WIBBLE:4:9 43// 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] 50// 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 52// 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= 59