go-llvm / llgo

LLVM-based compiler for Go
Other
1.25k stars 81 forks source link

Use compilation unit as struct scope in debug info #216

Closed pcc closed 9 years ago

pcc commented 9 years ago

It is incorrect to use d.scope() here because type descriptors are cached, so the resulting struct type will refer to the scope in which we happen to see the struct type for the first time.

This also works around an assertion failure in LLVM's code generator that can occur when a struct type's scope is a lexical block.

I had trouble minimising a test case for this, but it can be reproduced by building the package "launchpad.net/gozk".

axw commented 9 years ago

LGTM, thanks