[clang] [CIR] Upstream TypeInfo attribute (PR #159426)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 18 02:13:05 PDT 2025


================
@@ -2741,6 +2741,25 @@ LogicalResult cir::AtomicCmpXchg::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// TypeInfoAttr
+//===----------------------------------------------------------------------===//
+
+LogicalResult cir::TypeInfoAttr::verify(
+    ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError,
+    ::mlir::Type type, ::mlir::ArrayAttr typeinfoData) {
+
+  if (cir::ConstRecordAttr::verify(emitError, type, typeinfoData).failed())
+    return failure();
+
+  for (auto &member : typeinfoData) {
+    if (llvm::isa<GlobalViewAttr, IntAttr>(member))
+      continue;
+    return emitError() << "expected GlobalViewAttr or IntAttr attribute";
+  }
----------------
xlauko wrote:

this can be chacked with `ArrayOfAttr` as constriant in the definition

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


More information about the cfe-commits mailing list