From 70f66ab053f36ab3df7a778d09bcb2b4b0fec1f8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 20 Apr 2008 18:47:55 +0000 Subject: [PATCH] for exponent-related errors, emit the diagnostic on the 'e' or 'p'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49997 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/LiteralSupport.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index c52946fca5..c763c8b9da 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/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; } -- 2.40.0