================
@@ -424,6 +424,44 @@ 
cir::ConstVectorAttr::verify(function_ref<InFlightDiagnostic()> emitError,
   return elementTypeCheck;
 }
 
+//===----------------------------------------------------------------------===//
+// CIR VTableAttr
+//===----------------------------------------------------------------------===//
+
+LogicalResult cir::VTableAttr::verify(
+    llvm::function_ref<mlir::InFlightDiagnostic()> emitError, mlir::Type type,
+    mlir::ArrayAttr vtableData) {
+  auto sTy = mlir::dyn_cast_if_present<cir::RecordType>(type);
+  if (!sTy)
+    return emitError() << "expected !cir.record type result";
+  if (sTy.getMembers().empty() || vtableData.empty())
+    return emitError() << "expected record type with one or more subtype";
+
+  for (size_t i = 0; i < sTy.getMembers().size(); ++i) {
----------------
andykaylor wrote:

I thought the same thing when I was moving this over and had changed it in the 
way you suggest before finding the multi-vtable example 
(`clang/test/CIR/CodeGen/multi-vtable.cpp` in the incubator). It didn't occur 
to me until just now that, like you, I probably thought that because of what 
the comments in the attribute declaration said.

https://github.com/llvm/llvm-project/pull/154415
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to