================
@@ -152,31 +152,70 @@ void CIRDialect::printType(Type type, DialectAsmPrinter 
&os) const {
 
 // Shared helpers for StructType and UnionType parse/print.
 
-/// Parse "incomplete" or "{type, type, ...}", writing results into
-/// \p incomplete and \p members.  Returns failure if member parsing fails.
+llvm::SmallVector<RecordMemberKind>
+cir::getAllDataKinds(llvm::ArrayRef<mlir::Type> members) {
+  return llvm::SmallVector<RecordMemberKind>(members.size(),
+                                             RecordMemberKind::Data);
+}
+
+/// An incomplete record has no members, so a kind for one is caught by the
+/// same check.
+static mlir::LogicalResult
+verifyRecordMemberKinds(function_ref<mlir::InFlightDiagnostic()> emitError,
+                        size_t numMembers,
+                        llvm::ArrayRef<RecordMemberKind> memberKinds) {
+  if (memberKinds.size() != numMembers)
+    return emitError() << "expected " << numMembers << " member kinds, got "
+                       << memberKinds.size();
+  return mlir::success();
+}
+
+/// Consume a member's optional kind mark, returning whether one was there.
+/// Only a mark keyword is consumed, so anything that is not one is left for 
the
+/// type parser to accept or reject.
+static bool consumeOptionalMemberKindMark(mlir::AsmParser &parser,
+                                          RecordMemberKind &kind) {
+  static const llvm::StringRef marks[] = {"data", "pad", "empty"};
+  kind = RecordMemberKind::Data;
+  llvm::StringRef keyword;
+  if (parser.parseOptionalKeyword(&keyword, marks).failed())
----------------
adams381 wrote:

I'm so glad you are on board for not allowing BOTH.  I think that was 
confusing.  A `data` tag is now mandatory, and the parser returns the kind 
instead of a bool.  There is a lot of churn (every test that has a data 
member), but I think this is better.

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

Reply via email to