blob: 81e44f4823fa2b10b4160bd57710e68bc7046dd4 [file] [log] [blame]
Chris Lattnera3b605e2008-03-09 03:13:06 +00001//===--- MacroExpansion.cpp - Top level Macro Expansion -------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the top level handling of macro expasion for the
11// preprocessor.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Lex/Preprocessor.h"
16#include "MacroArgs.h"
17#include "clang/Lex/MacroInfo.h"
18#include "clang/Basic/SourceManager.h"
19#include "clang/Basic/FileManager.h"
20#include "clang/Basic/Diagnostic.h"
Chris Lattnerf90a2482008-03-18 05:59:11 +000021#include <ctime>
Chris Lattnera3b605e2008-03-09 03:13:06 +000022using namespace clang;
23
24/// setMacroInfo - Specify a macro for this identifier.
25///
26void Preprocessor::setMacroInfo(IdentifierInfo *II, MacroInfo *MI) {
27 if (MI == 0) {
28 if (II->hasMacroDefinition()) {
29 Macros.erase(II);
30 II->setHasMacroDefinition(false);
31 }
32 } else {
33 Macros[II] = MI;
34 II->setHasMacroDefinition(true);
35 }
36}
37
38/// RegisterBuiltinMacro - Register the specified identifier in the identifier
39/// table and mark it as a builtin macro to be expanded.
40IdentifierInfo *Preprocessor::RegisterBuiltinMacro(const char *Name) {
41 // Get the identifier.
42 IdentifierInfo *Id = getIdentifierInfo(Name);
43
44 // Mark it as being a macro that is builtin.
Ted Kremenek0ea76722008-12-15 19:56:42 +000045 MacroInfo *MI = AllocateMacroInfo(SourceLocation());
Chris Lattnera3b605e2008-03-09 03:13:06 +000046 MI->setIsBuiltinMacro();
47 setMacroInfo(Id, MI);
48 return Id;
49}
50
51
52/// RegisterBuiltinMacros - Register builtin macros, such as __LINE__ with the
53/// identifier table.
54void Preprocessor::RegisterBuiltinMacros() {
55 Ident__LINE__ = RegisterBuiltinMacro("__LINE__");
56 Ident__FILE__ = RegisterBuiltinMacro("__FILE__");
57 Ident__DATE__ = RegisterBuiltinMacro("__DATE__");
58 Ident__TIME__ = RegisterBuiltinMacro("__TIME__");
59 Ident_Pragma = RegisterBuiltinMacro("_Pragma");
60
61 // GCC Extensions.
62 Ident__BASE_FILE__ = RegisterBuiltinMacro("__BASE_FILE__");
63 Ident__INCLUDE_LEVEL__ = RegisterBuiltinMacro("__INCLUDE_LEVEL__");
64 Ident__TIMESTAMP__ = RegisterBuiltinMacro("__TIMESTAMP__");
65}
66
67/// isTrivialSingleTokenExpansion - Return true if MI, which has a single token
68/// in its expansion, currently expands to that token literally.
69static bool isTrivialSingleTokenExpansion(const MacroInfo *MI,
70 const IdentifierInfo *MacroIdent,
71 Preprocessor &PP) {
72 IdentifierInfo *II = MI->getReplacementToken(0).getIdentifierInfo();
73
74 // If the token isn't an identifier, it's always literally expanded.
75 if (II == 0) return true;
76
77 // If the identifier is a macro, and if that macro is enabled, it may be
78 // expanded so it's not a trivial expansion.
79 if (II->hasMacroDefinition() && PP.getMacroInfo(II)->isEnabled() &&
80 // Fast expanding "#define X X" is ok, because X would be disabled.
81 II != MacroIdent)
82 return false;
83
84 // If this is an object-like macro invocation, it is safe to trivially expand
85 // it.
86 if (MI->isObjectLike()) return true;
87
88 // If this is a function-like macro invocation, it's safe to trivially expand
89 // as long as the identifier is not a macro argument.
90 for (MacroInfo::arg_iterator I = MI->arg_begin(), E = MI->arg_end();
91 I != E; ++I)
92 if (*I == II)
93 return false; // Identifier is a macro argument.
94
95 return true;
96}
97
98
99/// isNextPPTokenLParen - Determine whether the next preprocessor token to be
100/// lexed is a '('. If so, consume the token and return true, if not, this
101/// method should have no observable side-effect on the lexed tokens.
102bool Preprocessor::isNextPPTokenLParen() {
103 // Do some quick tests for rejection cases.
104 unsigned Val;
105 if (CurLexer)
106 Val = CurLexer->isNextPPTokenLParen();
Ted Kremenek1a531572008-11-19 22:43:49 +0000107 else if (CurPTHLexer)
108 Val = CurPTHLexer->isNextPPTokenLParen();
Chris Lattnera3b605e2008-03-09 03:13:06 +0000109 else
110 Val = CurTokenLexer->isNextTokenLParen();
111
112 if (Val == 2) {
113 // We have run off the end. If it's a source file we don't
114 // examine enclosing ones (C99 5.1.1.2p4). Otherwise walk up the
115 // macro stack.
Ted Kremenek17ff58a2008-11-19 22:21:33 +0000116 if (CurPPLexer)
Chris Lattnera3b605e2008-03-09 03:13:06 +0000117 return false;
118 for (unsigned i = IncludeMacroStack.size(); i != 0; --i) {
119 IncludeStackInfo &Entry = IncludeMacroStack[i-1];
120 if (Entry.TheLexer)
121 Val = Entry.TheLexer->isNextPPTokenLParen();
Ted Kremenekdd95d6c2008-11-20 16:46:54 +0000122 else if (Entry.ThePTHLexer)
123 Val = Entry.ThePTHLexer->isNextPPTokenLParen();
Chris Lattnera3b605e2008-03-09 03:13:06 +0000124 else
125 Val = Entry.TheTokenLexer->isNextTokenLParen();
126
127 if (Val != 2)
128 break;
129
130 // Ran off the end of a source file?
Ted Kremenekdd95d6c2008-11-20 16:46:54 +0000131 if (Entry.ThePPLexer)
Chris Lattnera3b605e2008-03-09 03:13:06 +0000132 return false;
133 }
134 }
135
136 // Okay, if we know that the token is a '(', lex it and return. Otherwise we
137 // have found something that isn't a '(' or we found the end of the
138 // translation unit. In either case, return false.
139 if (Val != 1)
140 return false;
141
142 Token Tok;
143 LexUnexpandedToken(Tok);
144 assert(Tok.is(tok::l_paren) && "Error computing l-paren-ness?");
145 return true;
146}
147
148/// HandleMacroExpandedIdentifier - If an identifier token is read that is to be
149/// expanded as a macro, handle it and return the next token as 'Identifier'.
150bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
151 MacroInfo *MI) {
152 // If this is a macro exapnsion in the "#if !defined(x)" line for the file,
153 // then the macro could expand to different things in other contexts, we need
154 // to disable the optimization in this case.
Ted Kremenek68a91d52008-11-18 01:12:54 +0000155 if (CurPPLexer) CurPPLexer->MIOpt.ExpandedMacro();
Chris Lattnera3b605e2008-03-09 03:13:06 +0000156
157 // If this is a builtin macro, like __LINE__ or _Pragma, handle it specially.
158 if (MI->isBuiltinMacro()) {
159 ExpandBuiltinMacro(Identifier);
160 return false;
161 }
162
163 /// Args - If this is a function-like macro expansion, this contains,
164 /// for each macro argument, the list of tokens that were provided to the
165 /// invocation.
166 MacroArgs *Args = 0;
167
168 // If this is a function-like macro, read the arguments.
169 if (MI->isFunctionLike()) {
170 // C99 6.10.3p10: If the preprocessing token immediately after the the macro
171 // name isn't a '(', this macro should not be expanded. Otherwise, consume
172 // it.
173 if (!isNextPPTokenLParen())
174 return true;
175
176 // Remember that we are now parsing the arguments to a macro invocation.
177 // Preprocessor directives used inside macro arguments are not portable, and
178 // this enables the warning.
179 InMacroArgs = true;
180 Args = ReadFunctionLikeMacroArgs(Identifier, MI);
181
182 // Finished parsing args.
183 InMacroArgs = false;
184
185 // If there was an error parsing the arguments, bail out.
186 if (Args == 0) return false;
187
188 ++NumFnMacroExpanded;
189 } else {
190 ++NumMacroExpanded;
191 }
192
193 // Notice that this macro has been used.
194 MI->setIsUsed(true);
195
196 // If we started lexing a macro, enter the macro expansion body.
197
198 // If this macro expands to no tokens, don't bother to push it onto the
199 // expansion stack, only to take it right back off.
200 if (MI->getNumTokens() == 0) {
201 // No need for arg info.
202 if (Args) Args->destroy();
203
204 // Ignore this macro use, just return the next token in the current
205 // buffer.
206 bool HadLeadingSpace = Identifier.hasLeadingSpace();
207 bool IsAtStartOfLine = Identifier.isAtStartOfLine();
208
209 Lex(Identifier);
210
211 // If the identifier isn't on some OTHER line, inherit the leading
212 // whitespace/first-on-a-line property of this token. This handles
213 // stuff like "! XX," -> "! ," and " XX," -> " ,", when XX is
214 // empty.
215 if (!Identifier.isAtStartOfLine()) {
216 if (IsAtStartOfLine) Identifier.setFlag(Token::StartOfLine);
217 if (HadLeadingSpace) Identifier.setFlag(Token::LeadingSpace);
218 }
219 ++NumFastMacroExpanded;
220 return false;
221
222 } else if (MI->getNumTokens() == 1 &&
223 isTrivialSingleTokenExpansion(MI, Identifier.getIdentifierInfo(),
224 *this)){
225 // Otherwise, if this macro expands into a single trivially-expanded
226 // token: expand it now. This handles common cases like
227 // "#define VAL 42".
Sam Bishop9a4939f2008-03-21 07:13:02 +0000228
229 // No need for arg info.
230 if (Args) Args->destroy();
231
Chris Lattnera3b605e2008-03-09 03:13:06 +0000232 // Propagate the isAtStartOfLine/hasLeadingSpace markers of the macro
233 // identifier to the expanded token.
234 bool isAtStartOfLine = Identifier.isAtStartOfLine();
235 bool hasLeadingSpace = Identifier.hasLeadingSpace();
236
237 // Remember where the token is instantiated.
238 SourceLocation InstantiateLoc = Identifier.getLocation();
239
240 // Replace the result token.
241 Identifier = MI->getReplacementToken(0);
242
243 // Restore the StartOfLine/LeadingSpace markers.
244 Identifier.setFlagValue(Token::StartOfLine , isAtStartOfLine);
245 Identifier.setFlagValue(Token::LeadingSpace, hasLeadingSpace);
246
247 // Update the tokens location to include both its logical and physical
248 // locations.
249 SourceLocation Loc =
250 SourceMgr.getInstantiationLoc(Identifier.getLocation(), InstantiateLoc);
251 Identifier.setLocation(Loc);
252
253 // If this is #define X X, we must mark the result as unexpandible.
254 if (IdentifierInfo *NewII = Identifier.getIdentifierInfo())
255 if (getMacroInfo(NewII) == MI)
256 Identifier.setFlag(Token::DisableExpand);
257
258 // Since this is not an identifier token, it can't be macro expanded, so
259 // we're done.
260 ++NumFastMacroExpanded;
261 return false;
262 }
263
264 // Start expanding the macro.
265 EnterMacro(Identifier, Args);
266
267 // Now that the macro is at the top of the include stack, ask the
268 // preprocessor to read the next token from it.
269 Lex(Identifier);
270 return false;
271}
272
273/// ReadFunctionLikeMacroArgs - After reading "MACRO(", this method is
274/// invoked to read all of the actual arguments specified for the macro
275/// invocation. This returns null on error.
276MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
277 MacroInfo *MI) {
278 // The number of fixed arguments to parse.
279 unsigned NumFixedArgsLeft = MI->getNumArgs();
280 bool isVariadic = MI->isVariadic();
281
282 // Outer loop, while there are more arguments, keep reading them.
283 Token Tok;
284 Tok.setKind(tok::comma);
285 --NumFixedArgsLeft; // Start reading the first arg.
286
287 // ArgTokens - Build up a list of tokens that make up each argument. Each
288 // argument is separated by an EOF token. Use a SmallVector so we can avoid
289 // heap allocations in the common case.
290 llvm::SmallVector<Token, 64> ArgTokens;
291
292 unsigned NumActuals = 0;
293 while (Tok.is(tok::comma)) {
294 // C99 6.10.3p11: Keep track of the number of l_parens we have seen. Note
295 // that we already consumed the first one.
296 unsigned NumParens = 0;
297
298 while (1) {
299 // Read arguments as unexpanded tokens. This avoids issues, e.g., where
300 // an argument value in a macro could expand to ',' or '(' or ')'.
301 LexUnexpandedToken(Tok);
302
303 if (Tok.is(tok::eof) || Tok.is(tok::eom)) { // "#if f(<eof>" & "#if f(\n"
304 Diag(MacroName, diag::err_unterm_macro_invoc);
305 // Do not lose the EOF/EOM. Return it to the client.
306 MacroName = Tok;
307 return 0;
308 } else if (Tok.is(tok::r_paren)) {
309 // If we found the ) token, the macro arg list is done.
310 if (NumParens-- == 0)
311 break;
312 } else if (Tok.is(tok::l_paren)) {
313 ++NumParens;
314 } else if (Tok.is(tok::comma) && NumParens == 0) {
315 // Comma ends this argument if there are more fixed arguments expected.
316 if (NumFixedArgsLeft)
317 break;
318
319 // If this is not a variadic macro, too many args were specified.
320 if (!isVariadic) {
321 // Emit the diagnostic at the macro name in case there is a missing ).
322 // Emitting it at the , could be far away from the macro name.
323 Diag(MacroName, diag::err_too_many_args_in_macro_invoc);
324 return 0;
325 }
326 // Otherwise, continue to add the tokens to this variable argument.
327 } else if (Tok.is(tok::comment) && !KeepMacroComments) {
328 // If this is a comment token in the argument list and we're just in
329 // -C mode (not -CC mode), discard the comment.
330 continue;
331 } else if (Tok.is(tok::identifier)) {
332 // Reading macro arguments can cause macros that we are currently
333 // expanding from to be popped off the expansion stack. Doing so causes
334 // them to be reenabled for expansion. Here we record whether any
335 // identifiers we lex as macro arguments correspond to disabled macros.
336 // If so, we mark the token as noexpand. This is a subtle aspect of
337 // C99 6.10.3.4p2.
338 if (MacroInfo *MI = getMacroInfo(Tok.getIdentifierInfo()))
339 if (!MI->isEnabled())
340 Tok.setFlag(Token::DisableExpand);
341 }
342
343 ArgTokens.push_back(Tok);
344 }
345
346 // Empty arguments are standard in C99 and supported as an extension in
347 // other modes.
348 if (ArgTokens.empty() && !Features.C99)
349 Diag(Tok, diag::ext_empty_fnmacro_arg);
350
351 // Add a marker EOF token to the end of the token list for this argument.
352 Token EOFTok;
353 EOFTok.startToken();
354 EOFTok.setKind(tok::eof);
355 EOFTok.setLocation(Tok.getLocation());
356 EOFTok.setLength(0);
357 ArgTokens.push_back(EOFTok);
358 ++NumActuals;
359 --NumFixedArgsLeft;
360 };
361
362 // Okay, we either found the r_paren. Check to see if we parsed too few
363 // arguments.
364 unsigned MinArgsExpected = MI->getNumArgs();
365
366 // See MacroArgs instance var for description of this.
367 bool isVarargsElided = false;
368
369 if (NumActuals < MinArgsExpected) {
370 // There are several cases where too few arguments is ok, handle them now.
371 if (NumActuals+1 == MinArgsExpected && MI->isVariadic()) {
372 // Varargs where the named vararg parameter is missing: ok as extension.
373 // #define A(x, ...)
374 // A("blah")
375 Diag(Tok, diag::ext_missing_varargs_arg);
376
Chris Lattner63bc0352008-05-08 05:10:33 +0000377 // Remember this occurred if this is a macro invocation with at least
378 // one actual argument. This allows us to elide the comma when used for
379 // cases like:
380 // #define A(x, foo...) blah(a, ## foo)
381 // #define A(x, ...) blah(a, ## __VA_ARGS__)
382 isVarargsElided = MI->getNumArgs() > 1;
Chris Lattnera3b605e2008-03-09 03:13:06 +0000383 } else if (MI->getNumArgs() == 1) {
384 // #define A(x)
385 // A()
386 // is ok because it is an empty argument.
387
388 // Empty arguments are standard in C99 and supported as an extension in
389 // other modes.
390 if (ArgTokens.empty() && !Features.C99)
391 Diag(Tok, diag::ext_empty_fnmacro_arg);
392 } else {
393 // Otherwise, emit the error.
394 Diag(Tok, diag::err_too_few_args_in_macro_invoc);
395 return 0;
396 }
397
398 // Add a marker EOF token to the end of the token list for this argument.
399 SourceLocation EndLoc = Tok.getLocation();
400 Tok.startToken();
401 Tok.setKind(tok::eof);
402 Tok.setLocation(EndLoc);
403 Tok.setLength(0);
404 ArgTokens.push_back(Tok);
405 }
406
407 return MacroArgs::create(MI, &ArgTokens[0], ArgTokens.size(),isVarargsElided);
408}
409
410/// ComputeDATE_TIME - Compute the current time, enter it into the specified
411/// scratch buffer, then return DATELoc/TIMELoc locations with the position of
412/// the identifier tokens inserted.
413static void ComputeDATE_TIME(SourceLocation &DATELoc, SourceLocation &TIMELoc,
414 Preprocessor &PP) {
415 time_t TT = time(0);
416 struct tm *TM = localtime(&TT);
417
418 static const char * const Months[] = {
419 "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
420 };
421
422 char TmpBuffer[100];
423 sprintf(TmpBuffer, "\"%s %2d %4d\"", Months[TM->tm_mon], TM->tm_mday,
424 TM->tm_year+1900);
425 DATELoc = PP.CreateString(TmpBuffer, strlen(TmpBuffer));
426
427 sprintf(TmpBuffer, "\"%02d:%02d:%02d\"", TM->tm_hour, TM->tm_min, TM->tm_sec);
428 TIMELoc = PP.CreateString(TmpBuffer, strlen(TmpBuffer));
429}
430
431/// ExpandBuiltinMacro - If an identifier token is read that is to be expanded
432/// as a builtin macro, handle it and return the next token as 'Tok'.
433void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
434 // Figure out which token this is.
435 IdentifierInfo *II = Tok.getIdentifierInfo();
436 assert(II && "Can't be a macro without id info!");
437
438 // If this is an _Pragma directive, expand it, invoke the pragma handler, then
439 // lex the token after it.
440 if (II == Ident_Pragma)
441 return Handle_Pragma(Tok);
442
443 ++NumBuiltinMacroExpanded;
444
445 char TmpBuffer[100];
446
447 // Set up the return result.
448 Tok.setIdentifierInfo(0);
449 Tok.clearFlag(Token::NeedsCleaning);
450
451 if (II == Ident__LINE__) {
Chris Lattner4411f462008-09-29 23:12:31 +0000452 // __LINE__ expands to a simple numeric value. Add a space after it so that
453 // it will tokenize as a number (and not run into stuff after it in the temp
454 // buffer).
455 sprintf(TmpBuffer, "%u ",
456 SourceMgr.getLogicalLineNumber(Tok.getLocation()));
457 unsigned Length = strlen(TmpBuffer)-1;
Chris Lattnera3b605e2008-03-09 03:13:06 +0000458 Tok.setKind(tok::numeric_constant);
459 Tok.setLength(Length);
Chris Lattner4411f462008-09-29 23:12:31 +0000460 Tok.setLocation(CreateString(TmpBuffer, Length+1, Tok.getLocation()));
Chris Lattnera3b605e2008-03-09 03:13:06 +0000461 } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__) {
462 SourceLocation Loc = Tok.getLocation();
463 if (II == Ident__BASE_FILE__) {
464 Diag(Tok, diag::ext_pp_base_file);
465 SourceLocation NextLoc = SourceMgr.getIncludeLoc(Loc);
466 while (NextLoc.isValid()) {
467 Loc = NextLoc;
468 NextLoc = SourceMgr.getIncludeLoc(Loc);
469 }
470 }
471
472 // Escape this filename. Turn '\' -> '\\' '"' -> '\"'
473 std::string FN = SourceMgr.getSourceName(SourceMgr.getLogicalLoc(Loc));
474 FN = '"' + Lexer::Stringify(FN) + '"';
475 Tok.setKind(tok::string_literal);
476 Tok.setLength(FN.size());
477 Tok.setLocation(CreateString(&FN[0], FN.size(), Tok.getLocation()));
478 } else if (II == Ident__DATE__) {
479 if (!DATELoc.isValid())
480 ComputeDATE_TIME(DATELoc, TIMELoc, *this);
481 Tok.setKind(tok::string_literal);
482 Tok.setLength(strlen("\"Mmm dd yyyy\""));
483 Tok.setLocation(SourceMgr.getInstantiationLoc(DATELoc, Tok.getLocation()));
484 } else if (II == Ident__TIME__) {
485 if (!TIMELoc.isValid())
486 ComputeDATE_TIME(DATELoc, TIMELoc, *this);
487 Tok.setKind(tok::string_literal);
488 Tok.setLength(strlen("\"hh:mm:ss\""));
489 Tok.setLocation(SourceMgr.getInstantiationLoc(TIMELoc, Tok.getLocation()));
490 } else if (II == Ident__INCLUDE_LEVEL__) {
491 Diag(Tok, diag::ext_pp_include_level);
492
493 // Compute the include depth of this token.
494 unsigned Depth = 0;
495 SourceLocation Loc = SourceMgr.getIncludeLoc(Tok.getLocation());
496 for (; Loc.isValid(); ++Depth)
497 Loc = SourceMgr.getIncludeLoc(Loc);
498
Chris Lattner4411f462008-09-29 23:12:31 +0000499 // __INCLUDE_LEVEL__ expands to a simple numeric value. Add a space after
500 // it so that it will tokenize as a number (and not run into stuff after it
501 // in the temp buffer).
502 sprintf(TmpBuffer, "%u ", Depth);
503 unsigned Length = strlen(TmpBuffer)-1;
Chris Lattnera3b605e2008-03-09 03:13:06 +0000504 Tok.setKind(tok::numeric_constant);
505 Tok.setLength(Length);
506 Tok.setLocation(CreateString(TmpBuffer, Length, Tok.getLocation()));
507 } else if (II == Ident__TIMESTAMP__) {
508 // MSVC, ICC, GCC, VisualAge C++ extension. The generated string should be
509 // of the form "Ddd Mmm dd hh::mm::ss yyyy", which is returned by asctime.
510 Diag(Tok, diag::ext_pp_timestamp);
511
512 // Get the file that we are lexing out of. If we're currently lexing from
513 // a macro, dig into the include stack.
514 const FileEntry *CurFile = 0;
Ted Kremeneka275a192008-11-20 01:35:24 +0000515 PreprocessorLexer *TheLexer = getCurrentFileLexer();
Chris Lattnera3b605e2008-03-09 03:13:06 +0000516
517 if (TheLexer)
Ted Kremenekac80c6e2008-11-19 22:55:25 +0000518 CurFile = SourceMgr.getFileEntryForID(TheLexer->getFileID());
Chris Lattnera3b605e2008-03-09 03:13:06 +0000519
520 // If this file is older than the file it depends on, emit a diagnostic.
521 const char *Result;
522 if (CurFile) {
523 time_t TT = CurFile->getModificationTime();
524 struct tm *TM = localtime(&TT);
525 Result = asctime(TM);
526 } else {
527 Result = "??? ??? ?? ??:??:?? ????\n";
528 }
529 TmpBuffer[0] = '"';
530 strcpy(TmpBuffer+1, Result);
531 unsigned Len = strlen(TmpBuffer);
532 TmpBuffer[Len-1] = '"'; // Replace the newline with a quote.
533 Tok.setKind(tok::string_literal);
534 Tok.setLength(Len);
Chris Lattner4411f462008-09-29 23:12:31 +0000535 Tok.setLocation(CreateString(TmpBuffer, Len+1, Tok.getLocation()));
Chris Lattnera3b605e2008-03-09 03:13:06 +0000536 } else {
537 assert(0 && "Unknown identifier!");
538 }
539}