@@ -209,7 +209,7 @@ class NbdlWriter {
209209 else if (isa<ConstexprOp>(Op))
210210 return VisitType (cast<ConstexprOp>(Op));
211211 else
212- SetError (" unhandled operation (VisitType)" , Op);
212+ SetError (" unhandled operation (VisitType): {} " , Op);
213213 } else {
214214 // Handle mlir::BlockArgument.
215215 // Arguments cannot be `decltype(auto)`
@@ -285,8 +285,11 @@ class FuncWriter : public NbdlWriter<FuncWriter> {
285285 else if (isa<FuncOp>(Op)) return Visit (cast<FuncOp>(Op));
286286 else if (isa<MemberNameOp>(Op)) return Visit (cast<MemberNameOp>(Op));
287287 else if (isa<ConstexprOp, LiteralOp>(Op)) return ;
288+ else if (isa<UnitOp>(Op)) return ;
289+ else if (isa<EmptyOp>(Op))
290+ return SetError (" empty type does not map to c++" , Op);
288291 else
289- SetError (" unhandled operation" , Op);
292+ return SetError (" unhandled operation: {} " , Op);
290293 }
291294
292295 void VisitRegion (mlir::Region& R) {
@@ -342,8 +345,10 @@ class FuncWriter : public NbdlWriter<FuncWriter> {
342345 } else {
343346 OS << " nbdl::get(" ;
344347 WriteForwardedExpr (Op.getState ());
345- OS << ' ,' ;
346- WriteForwardedExpr (Op.getKey ());
348+ if (!isa<nbdl_gen::UnitType>(Op.getKey ().getType ())) {
349+ OS << " , " ;
350+ WriteForwardedExpr (Op.getKey ());
351+ }
347352 OS << " );\n " ;
348353 }
349354 }
@@ -361,8 +366,10 @@ class FuncWriter : public NbdlWriter<FuncWriter> {
361366 void Visit (MatchOp Op) {
362367 OS << " nbdl::match(" ;
363368 WriteForwardedExpr (Op.getStore ());
364- OS << " , " ;
365- WriteForwardedExpr (Op.getKey ());
369+ if (!isa<nbdl_gen::UnitType>(Op.getKey ().getType ())) {
370+ OS << " , " ;
371+ WriteForwardedExpr (Op.getKey ());
372+ }
366373 OS << " , " ;
367374 OS << " \n boost::hana::overload_linearly(" ;
368375
@@ -494,7 +501,7 @@ class ContextWriter : public NbdlWriter<ContextWriter> {
494501 return ;
495502 } else {
496503 mlir::Operation* Irr = Val.getDefiningOp ();
497- SetError (" unhandled operation" , Irr);
504+ SetError (" unhandled operation: (WriteMemberDecl) {} " , Irr);
498505 }
499506 }
500507
@@ -533,7 +540,6 @@ class ContextWriter : public NbdlWriter<ContextWriter> {
533540 if (!ContOp)
534541 return ;
535542
536-
537543 OS << Op.getName ();
538544 OS << ' (' ;
539545 llvm::interleaveComma (Op.getBody ().getArguments (), OS,
0 commit comments