aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/gcc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/cgo/gcc.go')
-rw-r--r--src/cmd/cgo/gcc.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index dc5639812a..79d27c3e37 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -577,8 +577,23 @@ func (p *Package) loadDWARF(f *File, conv *typeConv, names []*Name) {
switch e.Tag {
case dwarf.TagVariable:
name, _ := e.Val(dwarf.AttrName).(string)
+ // As of https://reviews.llvm.org/D123534, clang
+ // now emits DW_TAG_variable DIEs that have
+ // no name (so as to be able to describe the
+ // type and source locations of constant strings
+ // like the second arg in the call below:
+ //
+ // myfunction(42, "foo")
+ //
+ // If a var has no name we won't see attempts to
+ // refer to it via "C.<name>", so skip these vars
+ //
+ // See issue 53000 for more context.
+ if name == "" {
+ break
+ }
typOff, _ := e.Val(dwarf.AttrType).(dwarf.Offset)
- if name == "" || typOff == 0 {
+ if typOff == 0 {
if e.Val(dwarf.AttrSpecification) != nil {
// Since we are reading all the DWARF,
// assume we will see the variable elsewhere.