[cfe-commits] r49997 - /cfe/trunk/lib/Lex/LiteralSupport.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 20 11:47:55 PDT 2008
Author: lattner
Date: Sun Apr 20 13:47:55 2008
New Revision: 49997
URL: http://llvm.org/viewvc/llvm-project?rev=49997&view=rev
Log:
for exponent-related errors, emit the diagnostic on the 'e' or 'p'.
Modified:
cfe/trunk/lib/Lex/LiteralSupport.cpp
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=49997&r1=49996&r2=49997&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Sun Apr 20 13:47:55 2008
@@ -224,7 +224,8 @@
}
// 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 @@
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 @@
s = SkipDigits(s);
}
if (*s == 'e' || *s == 'E') { // exponent
+ const char *Exponent = s;
s++;
radix = 10;
saw_exponent = true;
@@ -283,7 +285,7 @@
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 @@
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 @@
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;
}
More information about the cfe-commits
mailing list