summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-31 18:53:44 +0000
committerChris Lattner <sabre@nondot.org>2012-01-31 18:53:44 +0000
commit21ae40e5135aa6bb9a02e3dcc447ba98471c59a3 (patch)
treea569e522d5f6e1d041af61c077a87d748fae9aef
parenta173ee56fd5c52fdb93da9c108b3de3be7779746 (diff)
downloadbcm5719-llvm-21ae40e5135aa6bb9a02e3dcc447ba98471c59a3.tar.gz
bcm5719-llvm-21ae40e5135aa6bb9a02e3dcc447ba98471c59a3.zip
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
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 035272279d6..d8cd4403916 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
OpenPOWER on IntegriCloud