dblaikie added a comment. In D70696#1765784 <https://reviews.llvm.org/D70696#1765784>, @probinson wrote:
> In D70696#1765671 <https://reviews.llvm.org/D70696#1765671>, @dblaikie wrote: > > > In D70696#1765637 <https://reviews.llvm.org/D70696#1765637>, @probinson > > wrote: > > > > > For the case: > > > > > > cat ref.c > > > extern int global_var; > > > int main() { return global_var; } > > > > > > > > > I *do* expect to see debug info for the declaration of global_var. > > > > > > FWIW I'd only expect it there with -fstandalone-debug - with > > -fno-standalone-debug I'd expect this code to rely on the assumption that > > def.c is also compiled with debug info. > > > When global_var is defined in a separate .so, you might not have the symbol > at all. It's helpful to be able to report "that symbol is defined outside > this executable" (and IIRC, gdb can look it up by mangled name and actually > show it to you anyway). Without even the declaration, you get "that symbol > that you can see right there in your source? It doesn't exist, haha." So, I > would definitely rather see a declaration for a referenced global. > Even if we currently don't do that. Same would be true of all functions as well though, right? Neither LLVM nor GCC emit declarations for all called functions (& I expect that'd produce significant size growth - I'm worried enough about global variable declarations that are referenced by unused inline functions or other similar things, and pull in complex type hierarchies, etc - let alone all functions called too). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70696/new/ https://reviews.llvm.org/D70696 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits