[PATCH] D22905: [llgo] set debuglocs for calls in synthetic functions

Andrew Wilkins via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 01:38:41 PDT 2016


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

Synthesized functions do not have valid locations,
and so we were not setting a debug location. Recent
changes to DI require that function call instructions
within a function having DI must have a location set.
We just set the debug location to line=0, col=0.

https://reviews.llvm.org/D22905

Files:
  debug/debug.go
  irgen/ssa.go

Index: irgen/ssa.go
===================================================================
--- irgen/ssa.go
+++ irgen/ssa.go
@@ -327,7 +327,7 @@
 	fr.addCommonFunctionAttrs(fr.function)
 	fr.function.SetLinkage(linkage)
 
-	fr.logf("Define function: %s", f.String())
+	fr.logf("Define function: %s @ %s", f.String(), fr.pkg.Prog.Fset.Position(f.Pos()))
 	fti := u.llvmtypes.getSignatureInfo(f.Signature)
 	delete(u.undefinedFuncs, f)
 	fr.retInf = fti.retInf
Index: debug/debug.go
===================================================================
--- debug/debug.go
+++ debug/debug.go
@@ -154,9 +154,6 @@
 
 // SetLocation sets the current debug location.
 func (d *DIBuilder) SetLocation(b llvm.Builder, pos token.Pos) {
-	if !pos.IsValid() {
-		return
-	}
 	position := d.fset.Position(pos)
 	d.lb = llvm.Metadata{}
 	if position.Filename != d.fnFile && position.Filename != "" {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22905.65885.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160728/aa5163e7/attachment.bin>


More information about the llvm-commits mailing list