summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-04-22 23:50:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-04-22 23:50:25 +0000
commit70ee92fa4d6a8d2d3d0726fcb8718204bfe87f57 (patch)
treea79279499a5eed40b1640c289a0cfaee12078b75 /clang/lib/Lex
parent7ad715d871c03757fb870f8567dd02e9bd18ed75 (diff)
downloadbcm5719-llvm-70ee92fa4d6a8d2d3d0726fcb8718204bfe87f57.tar.gz
bcm5719-llvm-70ee92fa4d6a8d2d3d0726fcb8718204bfe87f57.zip
Add some missing checks for C++1y digit separators that don't in fact separate
digits. Turns out we have completely separate lexing codepaths for floating point numbers depending on whether or not they start with a zero. Who knew... =) llvm-svn: 206932
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index ddfa10c6987..80e025def7b 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -765,6 +765,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
s++;
saw_period = true;
const char *floatDigitsBegin = s;
+ checkSeparator(TokLoc, s, CSK_BeforeDigits);
s = SkipHexDigits(s);
noSignificand &= (floatDigitsBegin == s);
}
@@ -779,6 +780,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
// A binary exponent can appear with or with a '.'. If dotted, the
// binary exponent is required.
if (*s == 'p' || *s == 'P') {
+ checkSeparator(TokLoc, s, CSK_AfterDigits);
const char *Exponent = s;
s++;
saw_exponent = true;
@@ -790,6 +792,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
hadError = true;
return;
}
+ checkSeparator(TokLoc, s, CSK_BeforeDigits);
s = first_non_digit;
if (!PP.getLangOpts().HexFloats)
@@ -858,9 +861,11 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
s++;
radix = 10;
saw_period = true;
+ checkSeparator(TokLoc, s, CSK_BeforeDigits);
s = SkipDigits(s); // Skip suffix.
}
if (*s == 'e' || *s == 'E') { // exponent
+ checkSeparator(TokLoc, s, CSK_AfterDigits);
const char *Exponent = s;
s++;
radix = 10;
@@ -868,6 +873,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
if (*s == '+' || *s == '-') s++; // sign
const char *first_non_digit = SkipDigits(s);
if (first_non_digit != s) {
+ checkSeparator(TokLoc, s, CSK_BeforeDigits);
s = first_non_digit;
} else {
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, Exponent-ThisTokBegin),
OpenPOWER on IntegriCloud