This patch adds support for evaluation of expressions referring to types
which were compiled in -flimit-debug-info (a.k.a -fno-standalone-debug)
in clang. In this mode it's possible that the debug information needed
to fully describe a c++ type is not present in a single shared library
- for example debug info for a base class or a member of a type can
only be found in another shared library. This situation is not
currently handled well within lldb as we are limited to searching within
a single shared library (lldb_private::Module) when searching for the
definition of these types.
The way that this patch gets around this limitation is by doing the
search at a later stage -- during the construction of the expression ast
context. This works by having the parser (currently SymbolFileDWARF, but
a similar approach is probably needed for PDBs too) mark a type as
"forcefully completed". What this means is that the parser has marked
the type as "complete" in the module ast context (as this is necessary
to e.g. derive classes from it), but its definition is not really there.
This is done via a new field on the ClangASTMetadata struct.
Later, when we are importing such a type into the expression ast, we
check this flag. If the flag is set, we try to find a better definition
for the type in other shared libraries. This part reuses the same code
path (ClangASTSource::CompleteType) that we are using to find
definitions of types that are incomplete in some module (the difference
between this situation and -flimit-debug-info is that in the former
case, the type is only ever used opaquely in the module -- e.g. FILE *
- whereas in the latter the type was fully defined in the source code,
but the compiler chose not to emit its definition in the debug info).
This required a small refactor of the ClangASTSource::CompleteType
function -- I split off the part which searches for the equivalent
complete type into a separate function. This was needed because the
import process operates slightly differently here. Previously, we were
being asked to complete an already imported forward declaration. Now we
are searching for an equivalent declaration before importing anything --
that's because importing an "forcefully completed" type would mark the
type as complete in the destination AST and we would not be asked to
complete it anymore.
This patch only implements this handling for base classes, but other
cases (members, array element types, etc.). The changes for that should
be fairly simple and mostly revolve around marking these types as
"forcefully completed" at an approriate time -- the importing logic is
Another aspect, which is also not handled by this patch is viewing these
types via the "frame variable" command. This does not use the AST
importer and so it will need to handle these types on its own -- that
will be the subject of another patch.