[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: [cfe-commits] r56876 - /cfe/trunk/lib/Lex/LiteralSupport.cpp
From: Chris Lattner <sabre () nondot ! org>
Date: 2008-09-30 20:45:40
Message-ID: 200809302045.m8UKjeKQ004969 () zion ! cs ! uiuc ! edu
[Download RAW message or body]
Author: lattner
Date: Tue Sep 30 15:45:40 2008
New Revision: 56876
URL: http://llvm.org/viewvc/llvm-project?rev=56876&view=rev
Log:
Document assumptions that NumericLiteralParser makes with an assertion.
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=56876&r1=56875&r2=56876&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Sep 30 15:45:40 2008
@@ -86,7 +86,8 @@
for (; ThisTokBuf != ThisTokEnd; ++ThisTokBuf) {
int CharVal = HexDigitValue(ThisTokBuf[0]);
if (CharVal == -1) break;
- Overflow |= (ResultChar & 0xF0000000) ? true : false; // About to shift out a \
digit? + // About to shift out a digit?
+ Overflow |= (ResultChar & 0xF0000000) ? true : false;
ResultChar <<= 4;
ResultChar |= CharVal;
}
@@ -196,6 +197,14 @@
NumericLiteralParser(const char *begin, const char *end,
SourceLocation TokLoc, Preprocessor &pp)
: PP(pp), ThisTokBegin(begin), ThisTokEnd(end) {
+
+ // This routine assumes that the range begin/end matches the regex for integer
+ // and FP constants (specifically, the 'pp-number' regex), and assumes that
+ // the byte at "*end" is both valid and not part of the regex. Because of
+ // this, it doesn't have to check for 'overscan' in various places.
+ assert(!isalnum(*end) && *end != '.' && *end != '_' &&
+ "Lexer didn't maximally munch?");
+
s = DigitsBegin = begin;
saw_exponent = false;
saw_period = false;
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic