PR17046, PR17092: Debug Info assert-on-valid due to member loss when context creation...
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 6 Sep 2013 06:45:04 +0000 (06:45 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 6 Sep 2013 06:45:04 +0000 (06:45 +0000)
commit3b1cc9b858462aa190e3b27089f6f9f8c9dd9bb6
tree6a47e89ab33d05b18f6ac65053a6ea3ac4b379ee
parent02c46bdb751774c366372f142153bda208046c50
PR17046, PR17092: Debug Info assert-on-valid due to member loss when context creation recreates the item the context is created for

By removing the possibility of strange partial definitions with no
members that older GCC's produced for the otherwise unreferenced outer
types of referenced inner types, we can simplify debug info generation
and correct this bug. Newer (4.8.1 and ToT) GCC's don't produce this
quirky debug info, and instead produce the full definition for the outer
type (except in the case where that type is dynamic and its vtable is
not emitted in this TU).

During the creation of the context for a type, we may revisit that type
(due to the need to visit template parameters, among other things) and
used to end up visiting it first there. Then when we would reach the
original code attempting to define that type, we would lose debug info
by overwriting its members.

By avoiding the possibility of latent "defined with no members" types,
we can be sure than whenever we already have a type in a cache (either a
definition or declaration), we can just return that. In the case of a
full definition, our work is done. In the case of a partial definition,
we must already be in the process of completing it. And in the case of a
declaration, the completed/vtable/etc callbacks can handle converting it
to a definition.

llvm-svn: 190122
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-class.cpp
clang/test/CodeGenCXX/debug-info-template-member.cpp