This is currently done for variables that aren't a file or function scope, but
the reason is unclear and might be historical. Static class member where
handled specifically and always generated a DW_TAG_member declarartion and
a DW_TAG_variable instance. This patch removes all these and only ever emits
one definition DIE, be it a DW_TAG_variable or a DW_TAG_member.
It would be good to get a gdb testsuite run with the patch applied before it
goes in to prevent any fallback (and I guess this kind of patch has a huge
fallback potential). I'll try to run lldb tests on my side.
This actually seems like it /might/ be a reasonable place for a separate declaration and definition, since the user wrote an out of line definition.
What location do we attribute the definition to? It might be worth checking the decl_line attribute in this test. Did we previously attribute the declaration and definition to their respective lines, or just duplicate one/the other of them?
How does this compare to other nested definitions (I suppose for functions in namespaces we don't emit both distinguishing the declaration and definition in cases like: "namespace x { void func(); } void x::func() {}" so there's arguably no reason to similarly for variables)