[PATCH] D17715: [LTO] Fix error reporting from lto_module_create_in_local_context()

Petr Pavlu via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 29 05:44:17 PST 2016


petpav01 created this revision.
petpav01 added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

Function `lto_module_create_in_local_context()` would previously rely on the default `LLVMContext` being created for it by `LTOModule::makeLTOModule()`. This context exits the program on error and is not arranged to update `sLastStringError` in `tools/lto/lto.cpp`.

Function `lto_module_create_in_local_context()` now creates an `LLVMContext` by itself, sets it up correctly to its needs and then passes it to `LTOModule::createInLocalContext()` which takes ownership of the context and keeps it present for the lifetime of the returned `LTOModule`.

Function `LTOModule::makeLTOModule()` is modified to take a reference to `LLVMContext` (instead of a pointer) and no longer creates a default context when `nullptr` is passed to it. Method `LTOModule::createInContext()` that takes a pointer to `LLVMContext` is removed because it allows to pass a `nullptr` to it. Instead `LTOModule::createFromBuffer()` (that takes a reference to `LLVMContext`) should be used.

http://reviews.llvm.org/D17715

Files:
  include/llvm/LTO/LTOModule.h
  lib/LTO/LTOModule.cpp
  test/tools/llvm-lto/Inputs/empty.bc
  test/tools/llvm-lto/error.ll
  tools/llvm-lto/llvm-lto.cpp
  tools/lto/lto.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17715.49361.patch
Type: text/x-patch
Size: 9022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160229/2bd49a41/attachment.bin>


More information about the llvm-commits mailing list