Skip to content

Commit b37c3c5

Browse files
committed
[readtapi] Cleanup usages of ExitOnError, NFCI (llvm#76745)
(cherry picked from commit b64992a)
1 parent ab255f7 commit b37c3c5

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

llvm/tools/llvm-readtapi/llvm-readtapi.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,12 @@ getInterfaceFile(const StringRef Filename, bool ResetBanner = true) {
108108
LLVM_FALLTHROUGH;
109109
case file_magic::macho_dynamically_linked_shared_lib_stub:
110110
LLVM_FALLTHROUGH;
111-
case file_magic::macho_universal_binary: {
112-
auto IFOrErr = DylibReader::get(Buffer->getMemBufferRef());
113-
if (!IFOrErr)
114-
ExitOnErr(IFOrErr.takeError());
115-
IF = std::move(*IFOrErr);
111+
case file_magic::macho_universal_binary:
112+
IF = ExitOnErr(DylibReader::get(Buffer->getMemBufferRef()));
116113
break;
117-
}
118-
case file_magic::tapi_file: {
119-
auto IFOrErr = TextAPIReader::get(Buffer->getMemBufferRef());
120-
if (!IFOrErr)
121-
ExitOnErr(IFOrErr.takeError());
122-
IF = std::move(*IFOrErr);
114+
case file_magic::tapi_file:
115+
IF = ExitOnErr(TextAPIReader::get(Buffer->getMemBufferRef()));
123116
break;
124-
}
125117
default:
126118
reportError(Filename + ": unsupported file type");
127119
}
@@ -170,10 +162,7 @@ static bool handleMergeAction(const Context &Ctx) {
170162
Out = std::move(IF);
171163
continue;
172164
}
173-
auto ResultIF = Out->merge(IF.get());
174-
if (!ResultIF)
175-
ExitOnErr(ResultIF.takeError());
176-
Out = std::move(ResultIF.get());
165+
Out = ExitOnErr(Out->merge(IF.get()));
177166
}
178167
return handleWriteAction(Ctx, std::move(Out));
179168
}

0 commit comments

Comments
 (0)