[clang] Lex: add support for `i128` and `ui128` suffixes (PR #130993)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 13 04:25:53 PDT 2025


================
@@ -3924,10 +3924,18 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
     // to get the integer value from an overly-wide APInt is *extremely*
     // expensive, so the naive approach of assuming
     // llvm::IntegerType::MAX_INT_BITS is a big performance hit.
-    unsigned BitsNeeded =
-        Literal.isBitInt ? llvm::APInt::getSufficientBitsNeeded(
-                               Literal.getLiteralDigits(), Literal.getRadix())
-                         : Context.getTargetInfo().getIntMaxTWidth();
+    unsigned BitsNeeded = Context.getTargetInfo().getIntMaxTWidth();
+    if (Literal.isBitInt)
+      BitsNeeded = llvm::APInt::getSufficientBitsNeeded(
+          Literal.getLiteralDigits(), Literal.getRadix());
+    if (Literal.MicrosoftInteger) {
+      if (Literal.MicrosoftInteger == 128 &&
----------------
Fznamznon wrote:

Do we really have to check `Literal.MicrosoftInteger` two times?
```suggestion
  if (Literal.MicrosoftInteger == 128 &&
```

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


More information about the cfe-commits mailing list