[llgo] set debuglocs for calls in synthetic functions
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.
Reviewers: pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D22905
llvm-svn: 288772
GitOrigin-RevId: 78ac1f1d42c8415ff0a84e1614bfe076b45ed061
diff --git a/debug/debug.go b/debug/debug.go
index 4331c9c..bd07d0a 100644
--- a/debug/debug.go
+++ b/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 != "" {
diff --git a/irgen/ssa.go b/irgen/ssa.go
index aada41c..f1c9d04 100644
--- a/irgen/ssa.go
+++ b/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