[llvm] b64992a - [readtapi] Cleanup usages of ExitOnError, NFCI (#76745)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 15:22:30 PST 2024
Author: Cyndy Ishida
Date: 2024-01-02T15:22:26-08:00
New Revision: b64992a367efbbea0b7ae3dd7711b2be26128f99
URL: https://github.com/llvm/llvm-project/commit/b64992a367efbbea0b7ae3dd7711b2be26128f99
DIFF: https://github.com/llvm/llvm-project/commit/b64992a367efbbea0b7ae3dd7711b2be26128f99.diff
LOG: [readtapi] Cleanup usages of ExitOnError, NFCI (#76745)
Added:
Modified:
llvm/tools/llvm-readtapi/llvm-readtapi.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-readtapi/llvm-readtapi.cpp b/llvm/tools/llvm-readtapi/llvm-readtapi.cpp
index 193a281d6341af..4bd47223ea91f5 100644
--- a/llvm/tools/llvm-readtapi/llvm-readtapi.cpp
+++ b/llvm/tools/llvm-readtapi/llvm-readtapi.cpp
@@ -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");
}
@@ -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));
}
More information about the llvm-commits
mailing list