[cfe-commits] r149397 - /cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Chris Lattner sabre at nondot.org
Tue Jan 31 10:53:44 PST 2012


Author: lattner
Date: Tue Jan 31 12:53:44 2012
New Revision: 149397

URL: http://llvm.org/viewvc/llvm-project?rev=149397&view=rev
Log:
fix a crash on:

__has_builtin

in an empty file, as we were overwriting the EOF token.  Overwriting an arbitrary token
never seems like a good idea in the error case.  This fixes a bug reported on the GCC
list :)

Modified:
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=149397&r1=149396&r2=149397&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Tue Jan 31 12:53:44 2012
@@ -1032,7 +1032,8 @@
     }
 
     OS << (int)Value;
-    Tok.setKind(tok::numeric_constant);
+    if (IsValid)
+      Tok.setKind(tok::numeric_constant);
   } else if (II == Ident__has_include ||
              II == Ident__has_include_next) {
     // The argument to these two builtins should be a parenthesized





More information about the cfe-commits mailing list