From 21ae40e5135aa6bb9a02e3dcc447ba98471c59a3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 31 Jan 2012 18:53:44 +0000 Subject: [PATCH] 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 :) llvm-svn: 149397 --- clang/lib/Lex/PPMacroExpansion.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 035272279d63..d8cd44039169 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -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