[llvm] r224567 - LTO: Export local context symbols

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Dec 18 23:19:50 PST 2014


Author: dexonsmith
Date: Fri Dec 19 01:19:50 2014
New Revision: 224567

URL: http://llvm.org/viewvc/llvm-project?rev=224567&view=rev
Log:
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()`.

Modified:
    llvm/trunk/tools/lto/lto.cpp
    llvm/trunk/tools/lto/lto.exports

Modified: llvm/trunk/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=224567&r1=224566&r2=224567&view=diff
==============================================================================
--- llvm/trunk/tools/lto/lto.cpp (original)
+++ llvm/trunk/tools/lto/lto.cpp Fri Dec 19 01:19:50 2014
@@ -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(
   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) {

Modified: llvm/trunk/tools/lto/lto.exports
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.exports?rev=224567&r1=224566&r2=224567&view=diff
==============================================================================
--- llvm/trunk/tools/lto/lto.exports (original)
+++ llvm/trunk/tools/lto/lto.exports Fri Dec 19 01:19:50 2014
@@ -6,6 +6,8 @@ lto_module_create_from_fd
 lto_module_create_from_fd_at_offset
 lto_module_create_from_memory
 lto_module_create_from_memory_with_path
+lto_module_create_in_local_context
+lto_module_create_in_codegen_context
 lto_module_get_deplib
 lto_module_get_linkeropt
 lto_module_get_num_deplibs
@@ -25,6 +27,7 @@ lto_codegen_add_module
 lto_codegen_add_must_preserve_symbol
 lto_codegen_compile
 lto_codegen_create
+lto_codegen_create_in_local_context
 lto_codegen_dispose
 lto_codegen_set_debug_model
 lto_codegen_set_pic_model





More information about the llvm-commits mailing list