Finish removing DestroySource.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 23 Dec 2014 19:16:45 +0000 (19:16 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 23 Dec 2014 19:16:45 +0000 (19:16 +0000)
Fixes pr21901.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224782 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/go/llvm/linker.go
bindings/ocaml/linker/linker_ocaml.c
bindings/ocaml/linker/llvm_linker.ml
bindings/ocaml/linker/llvm_linker.mli
include/llvm-c/Linker.h
lib/Linker/LinkModules.cpp
test/Bindings/OCaml/linker.ml

index 31e9ad24bf528c21004c985c242fc51bf78d38ef..64d794efb94e09035a002d206d5e7137b571cdab 100644 (file)
@@ -20,16 +20,9 @@ package llvm
 import "C"
 import "errors"
 
 import "C"
 import "errors"
 
-type LinkerMode C.LLVMLinkerMode
-
-const (
-       LinkerDestroySource  = C.LLVMLinkerDestroySource
-       LinkerPreserveSource = C.LLVMLinkerPreserveSource
-)
-
-func LinkModules(Dest, Src Module, Mode LinkerMode) error {
+func LinkModules(Dest, Src Module) error {
        var cmsg *C.char
        var cmsg *C.char
-       failed := C.LLVMLinkModules(Dest.C, Src.C, C.LLVMLinkerMode(Mode), &cmsg)
+       failed := C.LLVMLinkModules(Dest.C, Src.C, 0, &cmsg)
        if failed != 0 {
                err := errors.New(C.GoString(cmsg))
                C.LLVMDisposeMessage(cmsg)
        if failed != 0 {
                err := errors.New(C.GoString(cmsg))
                C.LLVMDisposeMessage(cmsg)
index ed37777d852c6208ad9785cd19ffb4ccf5f64667..3b8512aa595363cac48e5ca9635bc786a7de65d7 100644 (file)
 
 void llvm_raise(value Prototype, char *Message);
 
 
 void llvm_raise(value Prototype, char *Message);
 
-/* llmodule -> llmodule -> Mode.t -> unit */
-CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src, value Mode) {
+/* llmodule -> llmodule -> unit */
+CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src) {
   char* Message;
 
   char* Message;
 
-  if (LLVMLinkModules(Dst, Src, Int_val(Mode), &Message))
+  if (LLVMLinkModules(Dst, Src, 0, &Message))
     llvm_raise(*caml_named_value("Llvm_linker.Error"), Message);
 
   return Val_unit;
     llvm_raise(*caml_named_value("Llvm_linker.Error"), Message);
 
   return Val_unit;
index 5854d70bb525b62ccca422a0635f6891c3fadf91..3044abd8b6cf6281076a9090de765d87eb6547ff 100644 (file)
@@ -11,11 +11,5 @@ exception Error of string
 
 let () = Callback.register_exception "Llvm_linker.Error" (Error "")
 
 
 let () = Callback.register_exception "Llvm_linker.Error" (Error "")
 
-module Mode = struct
-  type t =
-  | DestroySource
-  | PreserveSource
-end
-
-external link_modules : Llvm.llmodule -> Llvm.llmodule -> Mode.t -> unit
+external link_modules : Llvm.llmodule -> Llvm.llmodule -> unit
                       = "llvm_link_modules"
                       = "llvm_link_modules"
index 4def7a8cc98398740e1c8e814f456454d527d81b..06c3b92a577e9d34b1dfb4fc429ee5230bf0250d 100644 (file)
 
 exception Error of string
 
 
 exception Error of string
 
-(** Linking mode. *)
-module Mode : sig
-  type t =
-  | DestroySource
-  | PreserveSource
-end
-
 (** [link_modules dst src mode] links [src] into [dst], raising [Error]
     if the linking fails. *)
 (** [link_modules dst src mode] links [src] into [dst], raising [Error]
     if the linking fails. *)
-val link_modules : Llvm.llmodule -> Llvm.llmodule -> Mode.t -> unit
\ No newline at end of file
+val link_modules : Llvm.llmodule -> Llvm.llmodule -> unit
\ No newline at end of file
index 9f337cfba477f5ccd07d22e20ddc74699b326119..cedde5ea8e3aa0af4ce35fd58a2121e3f4525cfb 100644 (file)
 extern "C" {
 #endif
 
 extern "C" {
 #endif
 
-
-typedef enum {
-  LLVMLinkerDestroySource = 0, /* Allow source module to be destroyed. */
-  LLVMLinkerPreserveSource = 1 /* Preserve the source module. */
-} LLVMLinkerMode;
-
-
 /* Links the source module into the destination module, taking ownership
  * of the source module away from the caller. Optionally returns a
  * human-readable description of any errors that occurred in linking.
  * OutMessage must be disposed with LLVMDisposeMessage. The return value
  * is true if an error occurred, false otherwise. */
 LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
 /* Links the source module into the destination module, taking ownership
  * of the source module away from the caller. Optionally returns a
  * human-readable description of any errors that occurred in linking.
  * OutMessage must be disposed with LLVMDisposeMessage. The return value
  * is true if an error occurred, false otherwise. */
 LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
-                         LLVMLinkerMode Mode, char **OutMessage);
+                         unsigned Unused, char **OutMessage);
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index 9ffdbc5dc860acbabd1f20a86b615dc7e6bb25d3..f9fba5e0a8008d8c14b489c0c159a2a0f8ef1d19 100644 (file)
@@ -1739,7 +1739,7 @@ bool Linker::LinkModules(Module *Dest, Module *Src) {
 //===----------------------------------------------------------------------===//
 
 LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
 //===----------------------------------------------------------------------===//
 
 LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
-                         LLVMLinkerMode Mode, char **OutMessages) {
+                         unsigned Unused, char **OutMessages) {
   Module *D = unwrap(Dest);
   std::string Message;
   raw_string_ostream Stream(Message);
   Module *D = unwrap(Dest);
   std::string Message;
   raw_string_ostream Stream(Message);
index 00064b0ba926eb8477b66a6f51d8b159935a2614..ac4b958ccc422e153d270a1b7201bf8510ae7b36 100644 (file)
@@ -45,7 +45,7 @@ let test_linker () =
 
   let m1 = make_module "one"
   and m2 = make_module "two" in
 
   let m1 = make_module "one"
   and m2 = make_module "two" in
-  link_modules m1 m2 Mode.DestroySource;
+  link_modules m1 m2;
   dispose_module m1;
 
   let m1 = make_module "one"
   dispose_module m1;
 
   let m1 = make_module "one"