bindings/go: expose DIBuilder::createReplaceableCompositeType
authorAndrew Wilkins <axwalk@gmail.com>
Mon, 2 Mar 2015 12:27:04 +0000 (12:27 +0000)
committerAndrew Wilkins <axwalk@gmail.com>
Mon, 2 Mar 2015 12:27:04 +0000 (12:27 +0000)
Summary:
We extend the DIBuilder type, adding a method for creating
replaceable composite types. This is necessary for creating
debug info describing self-referential types.

Reviewers: pcc

Reviewed By: pcc

Subscribers: axw, llvm-commits

Differential Revision: http://reviews.llvm.org/D7851

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

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

index a7d75a361d721a1770f1355ff3a9673e98507c6b..f39198df42d4911943927901ddfbf565fb596a03 100644 (file)
@@ -146,6 +146,18 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType(
   return wrap(CT);
 }
 
+LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
+    LLVMDIBuilderRef Dref, unsigned Tag, const char *Name,
+    LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
+    unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits,
+    unsigned Flags) {
+  DIBuilder *D = unwrap(Dref);
+  DICompositeType CT = D->createReplaceableCompositeType(
+      Tag, Name, unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File), Line,
+      RuntimeLang, SizeInBits, AlignInBits, Flags);
+  return wrap(CT);
+}
+
 LLVMMetadataRef
 LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Dref, LLVMMetadataRef Scope,
                               const char *Name, LLVMMetadataRef File,
index e268b3c93243cb1d032187fd242e3064cc114288..a4fba2784185bca950608935fdeeeff9f586d8b0 100644 (file)
@@ -84,6 +84,11 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType(
     uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
     LLVMMetadataRef ElementTypes);
 
+LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
+    LLVMDIBuilderRef D, unsigned Tag, const char *Name, LLVMMetadataRef Scope,
+    LLVMMetadataRef File, unsigned Line, unsigned RuntimeLang,
+    uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags);
+
 LLVMMetadataRef
 LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef D, LLVMMetadataRef Scope,
                               const char *Name, LLVMMetadataRef File,
index 3b1a1a645451fd6d93c6b73f1f22d643a93e4cec..f03f740b777002463c816b7386c40f1182b65c38 100644 (file)
@@ -343,6 +343,38 @@ func (d *DIBuilder) CreateStructType(scope Metadata, t DIStructType) Metadata {
        return Metadata{C: result}
 }
 
+// DIReplaceableCompositeType holds the values for creating replaceable
+// composite type debug metadata.
+type DIReplaceableCompositeType struct {
+       Tag         dwarf.Tag
+       Name        string
+       File        Metadata
+       Line        int
+       RuntimeLang int
+       SizeInBits  uint64
+       AlignInBits uint64
+       Flags       int
+}
+
+// CreateReplaceableCompositeType creates replaceable composite type debug metadata.
+func (d *DIBuilder) CreateReplaceableCompositeType(scope Metadata, t DIReplaceableCompositeType) Metadata {
+       name := C.CString(t.Name)
+       defer C.free(unsafe.Pointer(name))
+       result := C.LLVMDIBuilderCreateReplaceableCompositeType(
+               d.ref,
+               C.unsigned(t.Tag),
+               name,
+               scope.C,
+               t.File.C,
+               C.unsigned(t.Line),
+               C.unsigned(t.RuntimeLang),
+               C.uint64_t(t.SizeInBits),
+               C.uint64_t(t.AlignInBits),
+               C.unsigned(t.Flags),
+       )
+       return Metadata{C: result}
+}
+
 // DIMemberType holds the values for creating member type debug metadata.
 type DIMemberType struct {
        Name         string