[clang] [CIR] Integral types; simple global variables (PR #118743)

David Olsen via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 13:22:00 PST 2024


================
@@ -72,9 +63,15 @@ mlir::Type CIRGenTypes::convertType(QualType type) {
   }
   case Type::BitInt: {
     const auto *bitIntTy = cast<BitIntType>(type);
-    resultType =
-        cir::IntType::get(cgm.getBuilder().getContext(), bitIntTy->getNumBits(),
-                          bitIntTy->isSigned());
+    if (bitIntTy->getNumBits() > cir::IntType::maxBitwidth()) {
+      cgm.errorNYI(SourceLocation(), "large _BitInt type", type);
+      resultType = cir::IntType::get(cgm.getBuilder().getContext(), 32,
----------------
dkolsen-pgi wrote:

Compilation has failed at this point, so it doesn't really matter exactly what type is used.  I like the consistency of always returning `int` for not-yet-implemented types.  (That code will become simpler when aliases for the common CIR types are created.)


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


More information about the cfe-commits mailing list