diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-11-22 07:39:03 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-11-22 07:39:03 +0000 |
| commit | f3cb394f41e4ee58c419e6601170753ef702f555 (patch) | |
| tree | e84a5f5b3ae1c46b40debca39d8ef8d47d8ce2da | |
| parent | 5424e6d4ec69683c05d883354a3f5c1536cf98ad (diff) | |
| download | bcm5719-llvm-f3cb394f41e4ee58c419e6601170753ef702f555.tar.gz bcm5719-llvm-f3cb394f41e4ee58c419e6601170753ef702f555.zip | |
Fix a weird inconsistency with hex floats. Previously the lexer
would not eat the "-1" in "0x0p-1", but LiteralSupport would accept
it when extensions are on. This caused strangeness and failures
when hexfloats were properly treated as an extension (not error)
in LiteralSupport.
llvm-svn: 59865
| -rw-r--r-- | clang/lib/Lex/Lexer.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index b4d0717cd78..1e9789b14a7 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -574,8 +574,8 @@ void Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); // If we have a hex FP constant, continue. - if (Features.HexFloats && - (C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p')) + if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p') && + (Features.HexFloats || !Features.NoExtensions)) return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); // Update the location of token as well as BufferPtr. diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 6a1fad52bfe..fbd2c326ea7 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -378,10 +378,8 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { } s = first_non_digit; - if (!PP.getLangOptions().HexFloats) { + if (!PP.getLangOptions().HexFloats) PP.Diag(TokLoc, diag::ext_hexconstant_invalid); - hadError = true; - } } else if (saw_period) { PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), diag::err_hexconstant_requires_exponent); |

