================ @@ -400,13 +400,126 @@ def VoidPtr : Type< "cir::VoidType::get($_builder.getContext()))"> { } +//===----------------------------------------------------------------------===// +// StructType +// +// The base type for all RecordDecls. +//===----------------------------------------------------------------------===// + +def CIR_StructType : CIR_Type<"Struct", "struct", + [ + DeclareTypeInterfaceMethods<DataLayoutTypeInterface>, + MutableType, + ]> { + let summary = "CIR struct type"; + let description = [{ + Each unique clang::RecordDecl is mapped to a `cir.struct` and any object in ---------------- andykaylor wrote:
Yeah. It's not a great. The same thing sort of happens in LLVM IR, but there it makes a little bit more sense because unions, while represented as a structure, only contain the elements necessary to account for the memory, but that's also bad because to access any other member you end up treating it as something else. I just looked at the incubator handling of unions, and it does represent each member of the union as a unique member of the `cir.struct`. That is consistent with CIR's goal of representing the logical intent of the code. I understand why it's being done the way it is, but there is definitely potential for confusion. What would you think of renaming this to `cir.record`? That would introduce a clear distinction between this and `llvm.struct` in the LLVM dialect, which directly corresponds to llvm::StructType. https://github.com/llvm/llvm-project/pull/135105 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits