[clang] [C2y] Handle FP-suffixes on prefixed octals (#141230) (PR #141695)
Naveen Seth Hanig via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 06:19:48 PDT 2025
================
@@ -1432,14 +1432,26 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
Diags.Report(TokLoc, DiagId);
++s;
DigitsBegin = s;
- SawOctalPrefix = true;
+ radix = 8;
----------------
naveen-seth wrote:
I don't think the octal digits are skipped twice here, because the function now always returns before exiting the if-block we are currently in.
https://github.com/llvm/llvm-project/blob/8556e25c43fff5525501113f38dc0f3b48203f5c/clang/lib/Lex/LiteralSupport.cpp#L1447-L1448
This separates parsing for octals with a literal prefix from those starting with `0`, so that the logic for potentially parsing a floating-point only applies to the latter (otherwise, we get this crash).
Let me know if I am missing something here!
For the `radix` assignment, this could be shared between both cases if we move it above the current if statement.
https://github.com/llvm/llvm-project/pull/141695
More information about the cfe-commits
mailing list