diff options
author | Andy Gibbs <andyg1001@hotmail.co.uk> | 2012-11-17 19:14:53 +0000 |
---|---|---|
committer | Andy Gibbs <andyg1001@hotmail.co.uk> | 2012-11-17 19:14:53 +0000 |
commit | b9971bada4eeae74883b61ba96fc6d983b6b0e7f (patch) | |
tree | c5774497417dd31e99e8ee9e57ec7dda666e13f3 /lib/Lex | |
parent | 7baa711e61258a762db42e449e424bd0928318a6 (diff) |
Fix handling of invalid uses of the __has_warning builtin macro
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index de98d5019d..1f07a70d3a 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/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 |