From d27b926340143da725715a41ae878f02a43f231a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 23 Dec 2014 19:16:45 +0000 Subject: [PATCH] Finish removing DestroySource. Fixes pr21901. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224782 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/go/llvm/linker.go | 11 ++--------- bindings/ocaml/linker/linker_ocaml.c | 6 +++--- bindings/ocaml/linker/llvm_linker.ml | 8 +------- bindings/ocaml/linker/llvm_linker.mli | 9 +-------- include/llvm-c/Linker.h | 9 +-------- lib/Linker/LinkModules.cpp | 2 +- test/Bindings/OCaml/linker.ml | 2 +- 7 files changed, 10 insertions(+), 37 deletions(-) diff --git a/bindings/go/llvm/linker.go b/bindings/go/llvm/linker.go index 31e9ad24bf5..64d794efb94 100644 --- a/bindings/go/llvm/linker.go +++ b/bindings/go/llvm/linker.go @@ -20,16 +20,9 @@ package llvm 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 - 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) diff --git a/bindings/ocaml/linker/linker_ocaml.c b/bindings/ocaml/linker/linker_ocaml.c index ed37777d852..3b8512aa595 100644 --- a/bindings/ocaml/linker/linker_ocaml.c +++ b/bindings/ocaml/linker/linker_ocaml.c @@ -23,11 +23,11 @@ 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; - 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; diff --git a/bindings/ocaml/linker/llvm_linker.ml b/bindings/ocaml/linker/llvm_linker.ml index 5854d70bb52..3044abd8b6c 100644 --- a/bindings/ocaml/linker/llvm_linker.ml +++ b/bindings/ocaml/linker/llvm_linker.ml @@ -11,11 +11,5 @@ exception Error of string 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" diff --git a/bindings/ocaml/linker/llvm_linker.mli b/bindings/ocaml/linker/llvm_linker.mli index 4def7a8cc98..06c3b92a577 100644 --- a/bindings/ocaml/linker/llvm_linker.mli +++ b/bindings/ocaml/linker/llvm_linker.mli @@ -14,13 +14,6 @@ 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. *) -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 diff --git a/include/llvm-c/Linker.h b/include/llvm-c/Linker.h index 9f337cfba47..cedde5ea8e3 100644 --- a/include/llvm-c/Linker.h +++ b/include/llvm-c/Linker.h @@ -20,20 +20,13 @@ 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, - LLVMLinkerMode Mode, char **OutMessage); + unsigned Unused, char **OutMessage); #ifdef __cplusplus } diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 9ffdbc5dc86..f9fba5e0a80 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -1739,7 +1739,7 @@ bool Linker::LinkModules(Module *Dest, Module *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); diff --git a/test/Bindings/OCaml/linker.ml b/test/Bindings/OCaml/linker.ml index 00064b0ba92..ac4b958ccc4 100644 --- a/test/Bindings/OCaml/linker.ml +++ b/test/Bindings/OCaml/linker.ml @@ -45,7 +45,7 @@ let test_linker () = 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" -- 2.34.1