Skip to content

[readtapi] Cleanup usages of ExitOnError, NFCI #76745

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 1 commit into from
Jan 2, 2024
Merged
Changes from all commits
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
21 changes: 5 additions & 16 deletions llvm/tools/llvm-readtapi/llvm-readtapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,12 @@ getInterfaceFile(const StringRef Filename, bool ResetBanner = true) {
LLVM_FALLTHROUGH;
case file_magic::macho_dynamically_linked_shared_lib_stub:
LLVM_FALLTHROUGH;
case file_magic::macho_universal_binary: {
auto IFOrErr = DylibReader::get(Buffer->getMemBufferRef());
if (!IFOrErr)
ExitOnErr(IFOrErr.takeError());
IF = std::move(*IFOrErr);
case file_magic::macho_universal_binary:
IF = ExitOnErr(DylibReader::get(Buffer->getMemBufferRef()));
break;
}
case file_magic::tapi_file: {
auto IFOrErr = TextAPIReader::get(Buffer->getMemBufferRef());
if (!IFOrErr)
ExitOnErr(IFOrErr.takeError());
IF = std::move(*IFOrErr);
case file_magic::tapi_file:
IF = ExitOnErr(TextAPIReader::get(Buffer->getMemBufferRef()));
break;
}
default:
reportError(Filename + ": unsupported file type");
}
Expand Down Expand Up @@ -170,10 +162,7 @@ static bool handleMergeAction(const Context &Ctx) {
Out = std::move(IF);
continue;
}
auto ResultIF = Out->merge(IF.get());
if (!ResultIF)
ExitOnErr(ResultIF.takeError());
Out = std::move(ResultIF.get());
Out = ExitOnErr(Out->merge(IF.get()));
}
return handleWriteAction(Ctx, std::move(Out));
}
Expand Down