[clang] [C2y] Handle FP-suffixes on prefixed octals (#141230) (PR #141695)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 4 06:43:02 PDT 2025


================
@@ -1432,14 +1432,26 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
     Diags.Report(TokLoc, DiagId);
     ++s;
     DigitsBegin = s;
-    SawOctalPrefix = true;
+    radix = 8;
+    s = SkipOctalDigits(s);
+    if (s == ThisTokEnd) {
+      // Done
+    } else if ((isHexDigit(*s) && *s != 'e' && *s != 'E' && *s != '.') &&
+               !isValidUDSuffix(LangOpts, StringRef(s, ThisTokEnd - s))) {
+      Diags.Report(Lexer::AdvanceToTokenCharacter(TokLoc, s - ThisTokBegin, SM,
+                                                  LangOpts),
+                   diag::err_invalid_digit)
----------------
cor3ntin wrote:

Please extract `Lexer::AdvanceToTokenCharacter(TokLoc, s - ThisTokBegin, SM, LangOpts)` in a variable

https://github.com/llvm/llvm-project/pull/141695


More information about the cfe-commits mailing list