[clang] [APINotes] Refactor APINotesReader to propagate llvm::Error (PR #183812)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 2 03:22:58 PST 2026
================
@@ -98,8 +98,11 @@ APINotesManager::loadAPINotes(FileEntryRef APINotesFile) {
// Load the binary form we just compiled.
auto Reader = APINotesReader::Create(std::move(CompiledBuffer), SwiftVersion);
- assert(Reader && "Could not load the API notes we just generated?");
- return Reader;
+ if (!Reader) {
+ llvm::consumeError(Reader.takeError());
+ return nullptr;
+ }
+ return std::move(Reader.get());
----------------
Xazax-hun wrote:
Nit: do we need `std::move` here? I'd expect C++ to try to move the expression that was just returned even without `std::move`.
https://github.com/llvm/llvm-project/pull/183812
More information about the cfe-commits
mailing list