clang: include/clang/Lex/TokenLexer.h Source File (original) (raw)

32

33

35

36

37

39

40

42

43

44

45

46

47

48

49

50

51 const Token *Tokens;

52

53

54 unsigned NumTokens;

55

56

57 unsigned CurTokenIdx;

58

59

61

62

63

65

66

67

69

70

72

73

74 unsigned MacroDefLength;

75

76

77

78 bool AtStartOfLine : 1;

79 bool HasLeadingSpace : 1;

80

81

82

83

84

85

86

87 bool NextTokGetsSpace : 1;

88

89

90

91

92

93 bool OwnsTokens : 1;

94

95

96

97 bool DisableMacroExpansion : 1;

98

99

100

101 bool IsReinject : 1;

102

103public:

104

105

106

107

110 : PP(pp), OwnsTokens(false) {

111 Init(Tok, ILEnd, MI, ActualArgs);

112 }

113

114

115

116

117 TokenLexer(const Token *TokArray, unsigned NumToks, bool DisableExpansion,

118 bool ownsTokens, bool isReinject, Preprocessor &pp)

119 : PP(pp), OwnsTokens(false) {

120 Init(TokArray, NumToks, DisableExpansion, ownsTokens, isReinject);

121 }

122

126

127

128

129

130

133

134

135

136

137

138

139 void Init(const Token *TokArray, unsigned NumToks, bool DisableMacroExpansion,

140 bool OwnsTokens, bool IsReinject);

141

142

143

144

146

147

149

150

151

153

154private:

155 void destroy();

156

157

158

159 bool isAtEnd() const {

160 return CurTokenIdx == NumTokens;

161 }

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184 bool pasteTokens(Token &LHSTok, ArrayRef TokenStream,

185 unsigned int &CurIdx);

186

187

188

189 bool pasteTokens(Token &Tok);

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205 void stringifyVAOPTContents(SmallVectorImpl &ResultToks,

206 const VAOptExpansionContext &VCtx,

207 SourceLocation VAOPTClosingParenLoc);

208

209

210

211 void ExpandFunctionArguments();

212

213

214

215

216

217

218 void HandleMicrosoftCommentPaste(Token &Tok, SourceLocation OpLoc);

219

220

221

222

223 SourceLocation getExpansionLocForMacroDefLoc(SourceLocation loc) const;

224

225

226

227

228

229

230 void updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc,

231 Token *begin_tokens, Token *end_tokens);

232

233

234

235 bool MaybeRemoveCommaBeforeVaArgs(SmallVectorImpl &ResultToks,

236 bool HasPasteOperator,

237 MacroInfo *Macro, unsigned MacroArgNo,

239

240 void PropagateLineStartLeadingSpaceInfo(Token &Result);

241};

A class for tracking whether we're inside a VA_OPT during a traversal of the tokens of a macro during...