s++;
int c1 = s[0];
- int c2 = s[1];
// Handle a hex number like 0x1234.
- if ((c1 == 'x' || c1 == 'X') && (isHexDigit(c2) || c2 == '.')) {
+ if ((c1 == 'x' || c1 == 'X') && (isHexDigit(s[1]) || s[1] == '.')) {
s++;
+ assert(s < ThisTokEnd && "didn't maximally munch?");
radix = 16;
DigitsBegin = s;
s = SkipHexDigits(s);
}
// Handle simple binary numbers 0b01010
- if ((c1 == 'b' || c1 == 'B') && (c2 == '0' || c2 == '1')) {
+ if ((c1 == 'b' || c1 == 'B') && (s[1] == '0' || s[1] == '1')) {
// 0b101010 is a C++1y / GCC extension.
PP.Diag(TokLoc,
PP.getLangOpts().CPlusPlus14
? diag::ext_binary_literal_cxx14
: diag::ext_binary_literal);
++s;
+ assert(s < ThisTokEnd && "didn't maximally munch?");
radix = 2;
DigitsBegin = s;
s = SkipBinaryDigits(s);
--- /dev/null
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Wnewline-eof
+// vim: set binary noeol:
+
+// This file intentionally ends without a \n on the last line. Make sure your
+// editor doesn't add one.
+
+// expected-error@+2{{unterminated conditional directive}}
+// expected-warning@+1{{no newline at end of file}}
+#if 0
\ No newline at end of file