diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-20 18:47:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-20 18:47:55 +0000 |
commit | 4885b976644691a4f4549cb0663fdc9b133b9be7 (patch) | |
tree | 4353d56323d3ad7a3dc86d74d4892a4eab60a6c5 /clang/lib/Lex/LiteralSupport.cpp | |
parent | 48a9b9beeb4ceaaa0db42a095021dd12d8482a94 (diff) | |
download | bcm5719-llvm-4885b976644691a4f4549cb0663fdc9b133b9be7.tar.gz bcm5719-llvm-4885b976644691a4f4549cb0663fdc9b133b9be7.zip |
for exponent-related errors, emit the diagnostic on the 'e' or 'p'.
llvm-svn: 49997
Diffstat (limited to 'clang/lib/Lex/LiteralSupport.cpp')
-rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index c52946fca57..c763c8b9da2 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -224,7 +224,8 @@ NumericLiteralParser(const char *begin, const char *end, } // A binary exponent can appear with or with a '.'. If dotted, the // binary exponent is required. - if ((*s == 'p' || *s == 'P') && PP.getLangOptions().HexFloats) { + if ((*s == 'p' || *s == 'P') && PP.getLangOptions().HexFloats) { + const char *Exponent = s; s++; saw_exponent = true; if (*s == '+' || *s == '-') s++; // sign @@ -232,7 +233,7 @@ NumericLiteralParser(const char *begin, const char *end, if (first_non_digit != s) { s = first_non_digit; } else { - Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), + Diag(PP.AdvanceToTokenCharacter(TokLoc, Exponent-begin), diag::err_exponent_has_no_digits); return; } @@ -275,6 +276,7 @@ NumericLiteralParser(const char *begin, const char *end, s = SkipDigits(s); } if (*s == 'e' || *s == 'E') { // exponent + const char *Exponent = s; s++; radix = 10; saw_exponent = true; @@ -283,7 +285,7 @@ NumericLiteralParser(const char *begin, const char *end, if (first_non_digit != s) { s = first_non_digit; } else { - Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), + Diag(PP.AdvanceToTokenCharacter(TokLoc, Exponent-begin), diag::err_exponent_has_no_digits); return; } @@ -304,6 +306,7 @@ NumericLiteralParser(const char *begin, const char *end, s = SkipDigits(s); } if (*s == 'e' || *s == 'E') { // exponent + const char *Exponent = s; s++; saw_exponent = true; if (*s == '+' || *s == '-') s++; // sign @@ -311,7 +314,7 @@ NumericLiteralParser(const char *begin, const char *end, if (first_non_digit != s) { s = first_non_digit; } else { - Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin), + Diag(PP.AdvanceToTokenCharacter(TokLoc, Exponent-begin), diag::err_exponent_has_no_digits); return; } |