NFC: ExtractIRForPassTest.py error reporting when pass not found (#6325)

This just adds convenient error reporting to `ExtractIRForPassTest.py`
when the specified pass is not found.

No functional change.
This commit is contained in:
Tex Riddell 2024-05-24 13:39:38 -07:00 коммит произвёл GitHub
Родитель cdc56031b5
Коммит 128e6ce2be
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -86,8 +86,18 @@ def SplitAtPass(passes, pass_name, invocation=1):
after = [line]
continue
before.append(line)
if after is None:
raise Exception(f"no such pass: {pass_name}")
if count == 0:
raise ValueError(
"Pass '{}' not found in pass list. Check spelling and that it is a module pass. Pass list: {}".format(
pass_name, passes
)
)
elif count < invocation:
raise ValueError(
"Pass '{}' found {} times, but {} invocations requested. Pass list: {}".format(
pass_name, count, invocation, passes
)
)
return before, after