[clang] [llvm] [CIR][ABI] Add ABI metadata fields to RecordType (PR #188300)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 15:06:07 PDT 2026


================
@@ -738,7 +738,25 @@ def CIR_RecordType : CIR_Type<"Record", "record", [
     }
 
     void complete(llvm::ArrayRef<mlir::Type> members, bool packed,
-                  bool isPadded);
+                  bool isPadded, bool canPassInRegisters = false,
+                  bool hasTrivialDestructor = true,
+                  uint64_t recordAlignInBytes = 0);
+
+    /// Whether the record can be passed in registers per the C++
+    /// ABI.  Wraps RecordDecl::canPassInRegisters().  Named
+    /// records default to false; anonymous records default to true.
+    bool getCanPassInRegisters() const;
----------------
adams381 wrote:

Good catch. I went ahead and used a three-state enum (CanPassInRegs, CannotPassInRegs, CanNeverPassInRegs) mirroring the AST's RecordArgPassingKind. Today the classifier only checks the boolean, but keeping all three states is cheap and future-proofs us.

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


More information about the cfe-commits mailing list