[llvm] r230951 - bindings/go: expose DIBuilder::createReplaceableCompositeType

Andrew Wilkins axwalk at gmail.com
Mon Mar 2 04:27:04 PST 2015


Author: axw
Date: Mon Mar  2 06:27:04 2015
New Revision: 230951

URL: http://llvm.org/viewvc/llvm-project?rev=230951&view=rev
Log:
bindings/go: expose DIBuilder::createReplaceableCompositeType

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

Modified:
    llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp
    llvm/trunk/bindings/go/llvm/DIBuilderBindings.h
    llvm/trunk/bindings/go/llvm/dibuilder.go

Modified: llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp?rev=230951&r1=230950&r2=230951&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp (original)
+++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp Mon Mar  2 06:27:04 2015
@@ -146,6 +146,18 @@ LLVMMetadataRef LLVMDIBuilderCreateStruc
   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,

Modified: llvm/trunk/bindings/go/llvm/DIBuilderBindings.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/DIBuilderBindings.h?rev=230951&r1=230950&r2=230951&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/DIBuilderBindings.h (original)
+++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.h Mon Mar  2 06:27:04 2015
@@ -84,6 +84,11 @@ LLVMMetadataRef LLVMDIBuilderCreateStruc
     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,

Modified: llvm/trunk/bindings/go/llvm/dibuilder.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/dibuilder.go?rev=230951&r1=230950&r2=230951&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/dibuilder.go (original)
+++ llvm/trunk/bindings/go/llvm/dibuilder.go Mon Mar  2 06:27:04 2015
@@ -343,6 +343,38 @@ func (d *DIBuilder) CreateStructType(sco
 	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





More information about the llvm-commits mailing list