]> granicus.if.org Git - clang/commitdiff
fix a crash on:
authorChris Lattner <sabre@nondot.org>
Tue, 31 Jan 2012 18:53:44 +0000 (18:53 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 31 Jan 2012 18:53:44 +0000 (18:53 +0000)
__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 :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149397 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp

index 035272279d63fab0ac61c94870c34889ff1dee62..d8cd440391695e554e76167b735a197dffba2e05 100644 (file)
@@ -1032,7 +1032,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
     }
 
     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