Filecheck: Allow empty stderr input; replace last couple errs() uses (#3588)

This commit is contained in:
Tex Riddell 2021-03-16 08:22:34 -07:00 коммит произвёл GitHub
Родитель eed1d039da
Коммит 92fa2508c4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -1333,14 +1333,14 @@ int run_main() {
MemoryBuffer::getMemBuffer(MemoryBufferRef(StringRef(InputForStdin), "-")) :
MemoryBuffer::getFile(InputFilename);
if (std::error_code EC = FileOrErr.getError()) {
errs() << "Could not open input file '" << InputFilename
test_errs << "Could not open input file '" << InputFilename
<< "': " << EC.message() << '\n';
return 2;
}
std::unique_ptr<MemoryBuffer> &File = FileOrErr.get();
if (File->getBufferSize() == 0 && !AllowEmptyInput) {
errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
test_errs << "FileCheck error: '" << InputFilename << "' is empty.\n";
return 2;
}

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

@ -139,8 +139,10 @@ FileRunCommandResult FileRunCommandPart::RunFileChecker(const FileRunCommandResu
auto args = strtok(Arguments);
for (const std::string& arg : args) {
if (arg == "%s") hasInputFilename = true;
else if (arg == "-input=stderr") t.InputForStdin = Prior->StdErr;
else if (strstartswith(arg, checkPrefixStr))
else if (arg == "-input=stderr") {
t.InputForStdin = Prior->StdErr;
t.AllowEmptyInput = true;
} else if (strstartswith(arg, checkPrefixStr))
t.CheckPrefixes.emplace_back(arg.substr(sizeof(checkPrefixStr) - 1));
else if (strstartswith(arg, checkPrefixesStr)) {
auto prefixes = strtok(arg.substr(sizeof(checkPrefixesStr) - 1), ", ");