Skip to content

Commit

Permalink
[LTO] Fix lto_module_create_in_codegen_context return value on error
Browse files Browse the repository at this point in the history
According to the documentation, lto_module_create_in_codegen_context
should return NULL on error but currently it is accidentally return
error_code. Since this is a bug fix and it seems to be a one-off bug
that only affects this API, there is no need to bump API version.

rdar://101505192

Reviewed By: pete

Differential Revision: https://reviews.llvm.org/D136769
  • Loading branch information
cachemeifyoucan committed Oct 26, 2022
1 parent 1427550 commit 76ebaf2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/tools/lto/lto.cpp
Expand Up @@ -290,6 +290,8 @@ lto_module_t lto_module_create_in_codegen_context(const void *mem,
codegen::InitTargetOptionsFromCodeGenFlags(Triple());
ErrorOr<std::unique_ptr<LTOModule>> M = LTOModule::createFromBuffer(
unwrap(cg)->getContext(), mem, length, Options, StringRef(path));
if (!M)
return nullptr;
return wrap(M->release());
}

Expand Down

0 comments on commit 76ebaf2

Please sign in to comment.