[clang] [BitInt] Expose a _BitInt literal suffix in C++ (PR #86586)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 09:39:59 PDT 2024


================
@@ -1127,9 +1148,9 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
       // wb and WB are allowed, but a mixture of cases like Wb or wB is not. We
       // explicitly do not support the suffix in C++ as an extension because a
       // library-based UDL that resolves to a library type may be more
-      // appropriate there.
-      if (!LangOpts.CPlusPlus && ((s[0] == 'w' && s[1] == 'b') ||
-          (s[0] == 'W' && s[1] == 'B'))) {
+      // appropriate there. The same rules apply for __wb/__WB.
+      if ((!LangOpts.CPlusPlus || PossibleBitInt) &&
+          ((s[0] == 'w' && s[1] == 'b') || (s[0] == 'W' && s[1] == 'B'))) {
----------------
js324 wrote:

Sorry a little confused here, are we keeping the `s + 1 < ThisTokEnd` checks or should we change them to `s < ThisTokEnd` to allow looking into `ThisTokEnd` (for example`s < ThisTokEnd && s[1] == '_'`)

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


More information about the cfe-commits mailing list