From 72619d101fda15a98b8f406e6009c5da06e3f835 Mon Sep 17 00:00:00 2001 From: Mogball Date: Tue, 8 Feb 2022 21:13:58 +0000 Subject: [PATCH] [mlir][ods] NFC fix tblgen crash with empty assembly format --- mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp index d697ad2b4ea4..2a1fcf936237 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp @@ -812,6 +812,8 @@ LogicalResult DefFormatParser::verify(SMLoc loc, it.value().getName()); } } + if (elements.empty()) + return success(); // A `struct` directive that contains optional parameters cannot be followed // by a comma literal, which is ambiguous. for (auto it : llvm::zip(elements.drop_back(), elements.drop_front())) {