================
@@ -78,4 +78,48 @@ namespace cir {
 #define GET_TYPEDEF_CLASSES
 #include "clang/CIR/Dialect/IR/CIROpsTypes.h.inc"
 
+namespace cir {
+
+/// C++ view class for CIR struct/class record types.
+///
+/// Provides a type-safe handle for records with `RecordKind::Struct` or
+/// `RecordKind::Class`.  Use `mlir::dyn_cast<StructType>` or
+/// `mlir::isa<StructType>` in place of `recordTy.isStruct()` checks.
+class StructType : public RecordType {
----------------
adams381 wrote:

The updated PR has exactly this — `StructType` for struct/class (with `bool 
is_class`) and `UnionType` for union, sharing `RecordTypeStorage`.

MLIR TypeDef does not support C++ inheritance between user-defined types — each 
generated class inherits from `mlir::Type` directly.  The established pattern 
for a view covering two concrete types is `BaseMemRefType`: a hand-written 
class with implicit constructors from each and a `classof` covering both.  
`RecordType` follows that pattern.

https://github.com/llvm/llvm-project/pull/199790
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to