summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorAndy Gibbs <andyg1001@hotmail.co.uk>2012-11-17 19:14:53 +0000
committerAndy Gibbs <andyg1001@hotmail.co.uk>2012-11-17 19:14:53 +0000
commitf591982bb2908a80be2aebc52c98d9befc9b5937 (patch)
tree2459a655e1254eb39028c36f99097e2664af3ca5 /clang/lib/Lex
parent2794fcd61161882489741b4dc439cd8b9f2e6afe (diff)
downloadbcm5719-llvm-f591982bb2908a80be2aebc52c98d9befc9b5937.tar.gz
bcm5719-llvm-f591982bb2908a80be2aebc52c98d9befc9b5937.zip
Fix handling of invalid uses of the __has_warning builtin macro
llvm-svn: 168265
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index de98d5019da..1f07a70d3a5 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1291,7 +1291,10 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
StartLoc = Tok.getLocation();
IsValid = false;
// Eat tokens until ')'.
- do Lex(Tok); while (!(Tok.is(tok::r_paren) || Tok.is(tok::eod)));
+ while (Tok.isNot(tok::r_paren)
+ && Tok.isNot(tok::eod)
+ && Tok.isNot(tok::eof))
+ Lex(Tok);
break;
}
@@ -1342,7 +1345,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
Diag(StartLoc, diag::err_warning_check_malformed);
OS << (int)Value;
- Tok.setKind(tok::numeric_constant);
+ if (IsValid)
+ Tok.setKind(tok::numeric_constant);
} else if (II == Ident__building_module) {
// The argument to this builtin should be an identifier. The
// builtin evaluates to 1 when that identifier names the module we are
OpenPOWER on IntegriCloud