DebugInfo: Simplify/tidy/correct global variable decl/def emission handling.
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 23 Oct 2014 19:12:43 +0000 (19:12 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 23 Oct 2014 19:12:43 +0000 (19:12 +0000)
commit129ab6c6c5ea835f0ebc798e3f019f47af205201
treea9fc6a0f7dce382c27c4e83e2af97a96f7fb8a4e
parentb11d9944d9eca98a0a343483611b671b98ac4fe4
DebugInfo: Simplify/tidy/correct global variable decl/def emission handling.

This fixes a bug (introduced by fixing the IR emitted from Clang where
the definition of a static member would be scoped within the class,
rather than within its lexical decl context) where the definition of a
static variable would be placed inside a class.

It also improves source fidelity by scoping static class member
definitions inside the lexical decl context in which tehy are written
(eg: namespace n { class foo { static int i; } int foo::i; } - the
definition of 'i' will be within the namespace 'n' in the DWARF output
now).

Lastly, and the original goal, this reduces debug info size slightly
(and makes debug info easier to read, etc) by placing the definitions of
non-member global variables within their namespace, rather than using a
separate namespace-scoped declaration along with a definition at global
scope.

Based on patches and discussion with Frédéric.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220497 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
test/DebugInfo/X86/debug-info-static-member.ll
test/DebugInfo/X86/gnu-public-names.ll