summaryrefslogtreecommitdiffstats
path: root/llvm/tools/lto/lto.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-12-19 07:19:50 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-12-19 07:19:50 +0000
commitd34b613b92fc6e64e24f7581d8c626203cbb4fc8 (patch)
tree42c2708a5fc60604b938fc614b0ca2f0fc28a75b /llvm/tools/lto/lto.cpp
parent46d7af57291fc2e4a2e721303389f5fc6c1b6999 (diff)
downloadbcm5719-llvm-d34b613b92fc6e64e24f7581d8c626203cbb4fc8.tar.gz
bcm5719-llvm-d34b613b92fc6e64e24f7581d8c626203cbb4fc8.zip
LTO: Export local context symbols
Export symbols in libLTO.dylib for the local context-related functions added in r221733 (`LTO_API_VERSION=11`)... and add the missing definition for `lto_codegen_create_in_local_context()`. llvm-svn: 224567
Diffstat (limited to 'llvm/tools/lto/lto.cpp')
-rw-r--r--llvm/tools/lto/lto.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index ef37c90ba3b..ec0372ea560 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/tools/lto/lto.cpp
@@ -14,6 +14,7 @@
#include "llvm-c/lto.h"
#include "llvm/CodeGen/CommandFlags.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/LTO/LTOCodeGenerator.h"
#include "llvm/LTO/LTOModule.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -213,17 +214,27 @@ void lto_codegen_set_diagnostic_handler(lto_code_gen_t cg,
unwrap(cg)->setDiagnosticHandler(diag_handler, ctxt);
}
-lto_code_gen_t lto_codegen_create(void) {
+static lto_code_gen_t createCodeGen(bool InLocalContext) {
lto_initialize();
TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
- LTOCodeGenerator *CodeGen = new LTOCodeGenerator();
+ LTOCodeGenerator *CodeGen =
+ InLocalContext ? new LTOCodeGenerator(make_unique<LLVMContext>())
+ : new LTOCodeGenerator();
if (CodeGen)
CodeGen->setTargetOptions(Options);
return wrap(CodeGen);
}
+lto_code_gen_t lto_codegen_create(void) {
+ return createCodeGen(/* InLocalContext */ false);
+}
+
+lto_code_gen_t lto_codegen_create_in_local_context(void) {
+ return createCodeGen(/* InLocalContext */ true);
+}
+
void lto_codegen_dispose(lto_code_gen_t cg) { delete unwrap(cg); }
bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
OpenPOWER on IntegriCloud