[PATCH] D11891: [llgo] update to new DIBuilder API

Andrew Wilkins via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 18:40:26 PDT 2015


axw created this revision.
axw added a reviewer: pcc.
axw added a subscriber: llvm-commits.

Companion to D11864, which updates the
DIBuilder bindings to match a recent
change in the underlying API.

http://reviews.llvm.org/D11891

Files:
  debug/debug.go

Index: debug/debug.go
===================================================================
--- debug/debug.go
+++ debug/debug.go
@@ -150,24 +150,29 @@
 // Declare creates an llvm.dbg.declare call for the specified function
 // parameter or local variable.
 func (d *DIBuilder) Declare(b llvm.Builder, v ssa.Value, llv llvm.Value, paramIndex int) {
-	tag := tagAutoVariable
-	if paramIndex >= 0 {
-		tag = tagArgVariable
-	}
 	var diFile llvm.Metadata
 	var line int
 	if file := d.fset.File(v.Pos()); file != nil {
 		line = file.Line(v.Pos())
 		diFile = d.getFile(file)
 	}
-	localVar := d.builder.CreateLocalVariable(d.scope(), llvm.DILocalVariable{
-		Tag:   tag,
-		Name:  llv.Name(),
-		File:  diFile,
-		Line:  line,
-		ArgNo: paramIndex + 1,
-		Type:  d.DIType(v.Type()),
-	})
+	var localVar llvm.Metadata
+	if paramIndex >= 0 {
+		localVar = d.builder.CreateParameterVariable(d.scope(), llvm.DIParameterVariable{
+			Name:  llv.Name(),
+			File:  diFile,
+			Line:  line,
+			ArgNo: paramIndex + 1,
+			Type:  d.DIType(v.Type()),
+		})
+	} else {
+		localVar = d.builder.CreateAutoVariable(d.scope(), llvm.DIAutoVariable{
+			Name: llv.Name(),
+			File: diFile,
+			Line: line,
+			Type: d.DIType(v.Type()),
+		})
+	}
 	expr := d.builder.CreateExpression(nil)
 	d.builder.InsertDeclareAtEnd(llv, localVar, expr, b.GetInsertBlock())
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11891.31627.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150810/006c2cff/attachment.bin>


More information about the llvm-commits mailing list