summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-16 23:16:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-16 23:16:33 +0000
commitd912be98f8ebfa99ab9fa2d985d3f4e9cddf2df6 (patch)
tree53c875efa5c19336c13354b0678726a84fcf6f6e /bindings
parent2f9965d1349581a9e56612aac9f17e823c7e7c3d (diff)
Change linkInModule to take a std::unique_ptr.
Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/go/llvm/linker.go6
-rw-r--r--bindings/ocaml/linker/linker_ocaml.c6
-rw-r--r--bindings/ocaml/linker/llvm_linker.ml4
-rw-r--r--bindings/ocaml/linker/llvm_linker.mli6
4 files changed, 9 insertions, 13 deletions
diff --git a/bindings/go/llvm/linker.go b/bindings/go/llvm/linker.go
index f64f66c858e..63979c2f5ac 100644
--- a/bindings/go/llvm/linker.go
+++ b/bindings/go/llvm/linker.go
@@ -21,11 +21,9 @@ import "C"
import "errors"
func LinkModules(Dest, Src Module) error {
- var cmsg *C.char
- failed := C.LLVMLinkModules(Dest.C, Src.C, C.LLVMLinkerDestroySource, &cmsg)
+ failed := C.LLVMLinkModules2(Dest.C, Src.C)
if failed != 0 {
- err := errors.New(C.GoString(cmsg))
- C.LLVMDisposeMessage(cmsg)
+ err := errors.New("Linking failed")
return err
}
return nil
diff --git a/bindings/ocaml/linker/linker_ocaml.c b/bindings/ocaml/linker/linker_ocaml.c
index 3b8512aa595..498a5f0c845 100644
--- a/bindings/ocaml/linker/linker_ocaml.c
+++ b/bindings/ocaml/linker/linker_ocaml.c
@@ -25,10 +25,8 @@ void llvm_raise(value Prototype, char *Message);
/* llmodule -> llmodule -> unit */
CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src) {
- char* Message;
-
- if (LLVMLinkModules(Dst, Src, 0, &Message))
- llvm_raise(*caml_named_value("Llvm_linker.Error"), Message);
+ if (LLVMLinkModules2(Dst, Src))
+ llvm_raise(*caml_named_value("Llvm_linker.Error"), "Linking failed");
return Val_unit;
}
diff --git a/bindings/ocaml/linker/llvm_linker.ml b/bindings/ocaml/linker/llvm_linker.ml
index 3044abd8b6c..f2b64eeee91 100644
--- a/bindings/ocaml/linker/llvm_linker.ml
+++ b/bindings/ocaml/linker/llvm_linker.ml
@@ -11,5 +11,5 @@ exception Error of string
let () = Callback.register_exception "Llvm_linker.Error" (Error "")
-external link_modules : Llvm.llmodule -> Llvm.llmodule -> unit
- = "llvm_link_modules"
+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 06c3b92a577..5f558ffb116 100644
--- a/bindings/ocaml/linker/llvm_linker.mli
+++ b/bindings/ocaml/linker/llvm_linker.mli
@@ -14,6 +14,6 @@
exception Error of string
-(** [link_modules dst src mode] links [src] into [dst], raising [Error]
- if the linking fails. *)
-val link_modules : Llvm.llmodule -> Llvm.llmodule -> unit \ No newline at end of file
+(** [link_modules' dst src] links [src] into [dst], raising [Error]
+ if the linking fails. The src module is destroyed. *)
+val link_modules' : Llvm.llmodule -> Llvm.llmodule -> unit \ No newline at end of file