Skip to content

tools: move catching verification and parsing errors from CommandLineTool to xDSLOptMain #3915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion xdsl/tools/command_line_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ def register_all_arguments(self, arg_parser: argparse.ArgumentParser):
)
arg_parser.add_argument("--disable-verify", default=False, action="store_true")

arg_parser.add_argument(
"--verify-diagnostics",
default=False,
action="store_true",
help="Prints the content of a triggered "
"verifier exception and exits with code 0",
)

arg_parser.add_argument(
"--parsing-diagnostics",
default=False,
action="store_true",
help="Prints the content of a triggered "
"parsing exception and exits with code 0",
)

arg_parser.add_argument(
"--allow-unregistered-dialect",
default=False,
Expand Down Expand Up @@ -113,7 +129,7 @@ def parse_chunk(
except ParseError as e:
s = e.span
e.span = Span(s.start, s.end, s.input, start_offset)
if "parsing_diagnostics" in self.args and self.args.parsing_diagnostics:
if self.args.parsing_diagnostics:
print(e)
else:
raise
Expand Down
16 changes: 0 additions & 16 deletions xdsl/xdsl_opt_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,6 @@ def register_all_arguments(self, arg_parser: argparse.ArgumentParser):
help="Print the IR between each pass",
)

arg_parser.add_argument(
"--verify-diagnostics",
default=False,
action="store_true",
help="Prints the content of a triggered "
"verifier exception and exits with code 0",
)

arg_parser.add_argument(
"--parsing-diagnostics",
default=False,
action="store_true",
help="Prints the content of a triggered "
"parsing exception and exits with code 0",
)

arg_parser.add_argument(
"--split-input-file",
default=False,
Expand Down
Loading