Update go bindings to use new functions from rL317135.
authorSam McCall <sam.mccall@gmail.com>
Thu, 2 Nov 2017 10:22:26 +0000 (10:22 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 2 Nov 2017 10:22:26 +0000 (10:22 +0000)
This fixes duplicate symbol problems.

llvm-svn: 317195

llvm/bindings/go/llvm/DIBuilderBindings.cpp
llvm/bindings/go/llvm/DIBuilderBindings.h
llvm/bindings/go/llvm/dibuilder.go

index a43bf97..ea53694 100644 (file)
@@ -29,25 +29,6 @@ void LLVMDIBuilderDestroy(LLVMDIBuilderRef dref) {
   delete d;
 }
 
-void LLVMDIBuilderFinalize(LLVMDIBuilderRef dref) { unwrap(dref)->finalize(); }
-
-LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef Dref,
-                                               unsigned Lang, const char *File,
-                                               const char *Dir,
-                                               const char *Producer,
-                                               int Optimized, const char *Flags,
-                                               unsigned RuntimeVersion) {
-  DIBuilder *D = unwrap(Dref);
-  return wrap(D->createCompileUnit(Lang, D->createFile(File, Dir), Producer,
-                                   Optimized, Flags, RuntimeVersion));
-}
-
-LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef Dref, const char *File,
-                                        const char *Dir) {
-  DIBuilder *D = unwrap(Dref);
-  return wrap(D->createFile(File, Dir));
-}
-
 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef Dref,
                                                 LLVMMetadataRef Scope,
                                                 LLVMMetadataRef File,
index b097f2e..cc5d2c1 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "IRBindings.h"
 #include "llvm-c/Core.h"
+#include "llvm-c/DebugInfo.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -30,16 +31,6 @@ typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
 LLVMDIBuilderRef LLVMNewDIBuilder(LLVMModuleRef m);
 
 void LLVMDIBuilderDestroy(LLVMDIBuilderRef d);
-void LLVMDIBuilderFinalize(LLVMDIBuilderRef d);
-
-LLVMMetadataRef
-LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef D, unsigned Language,
-                               const char *File, const char *Dir,
-                               const char *Producer, int Optimized,
-                               const char *Flags, unsigned RuntimeVersion);
-
-LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef D, const char *File,
-                                        const char *Dir);
 
 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef D,
                                                 LLVMMetadataRef Scope,
index 9d59e83..475fa68 100644 (file)
@@ -132,12 +132,17 @@ func (d *DIBuilder) CreateCompileUnit(cu DICompileUnit) Metadata {
        defer C.free(unsafe.Pointer(flags))
        result := C.LLVMDIBuilderCreateCompileUnit(
                d.ref,
-               C.unsigned(cu.Language),
-               file, dir,
-               producer,
-               boolToCInt(cu.Optimized),
-               flags,
+               C.LLVMDWARFSourceLanguage(cu.Language),
+               C.LLVMDIBuilderCreateFile(d.ref, file, C.size_t(len(cu.File)), dir, C.size_t(len(cu.Dir))),
+               producer, C.size_t(len(cu.Producer)),
+               C.LLVMBool(boolToCInt(cu.Optimized)),
+               flags, C.size_t(len(cu.Flags)),
                C.unsigned(cu.RuntimeVersion),
+               /*SplitName=*/ nil, 0,
+               C.LLVMDWARFEmissionFull,
+               /*DWOId=*/ 0,
+               /*SplitDebugInlining*/ C.LLVMBool(boolToCInt(true)),
+               /*DebugInfoForProfiling*/ C.LLVMBool(boolToCInt(false)),
        )
        return Metadata{C: result}
 }
@@ -148,7 +153,9 @@ func (d *DIBuilder) CreateFile(filename, dir string) Metadata {
        defer C.free(unsafe.Pointer(cfilename))
        cdir := C.CString(dir)
        defer C.free(unsafe.Pointer(cdir))
-       result := C.LLVMDIBuilderCreateFile(d.ref, cfilename, cdir)
+       result := C.LLVMDIBuilderCreateFile(d.ref,
+               cfilename, C.size_t(len(filename)),
+               cdir, C.size_t(len(dir)))
        return Metadata{C: result}
 }