Open llvmbot opened 10 years ago
Unused file-scoped entities aren't emitted by LLVM. There's a flag to force it, but nothing to get the "half way" behavior of debug info describing it, but LLVM not emitting it (and thus having the debug info describe that the global variable has been optimized away).
Someone could potentially add this at some point, but not high on anyone's list so far as I know.
@llvm/issue-subscribers-debuginfo
Author: None (llvmbot)
Extended Description
$ cat test.cpp namespace B { namespace { class D { public: int i; }; } }
B::D x;
int main() { }
$ clang++ test.cpp -g
$ gdb a.out GNU gdb (GDB) SUSE (7.3-0.10.1) Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "ppc64-suse-linux". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /nfs/terran/home/zhuhw/working/test/a.out...done. (gdb) ptype x No symbol "x" in current context.