hanchenye-llvm-project/lldb
Greg Clayton 6beaaa680a A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a 
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.

A few months ago I worked with the llvm/clang folks to have the 
ExternalASTSource class be able to complete classes if there weren't completed
yet:

class ExternalASTSource {
....

    virtual void
    CompleteType (clang::TagDecl *Tag);
    
    virtual void 
    CompleteType (clang::ObjCInterfaceDecl *Class);
};

This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.

This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
  objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
  types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
  ClangASTType, and more) can now be iterating through children of any type,
  and if a class/union/struct type (clang::RecordType or ObjC interface) 
  is found that is incomplete, we can ask the AST to get the definition. 
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
  all child SymbolFileDWARF classes will share (much like what happens when
  we have a complete linked DWARF for an executable).
  
We will need to modify some of the ClangUserExpression code to take more 
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.

llvm-svn: 123613
2011-01-17 03:46:26 +00:00
..
docs Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener. 2011-01-08 20:28:42 +00:00
examples Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener. 2011-01-08 20:28:42 +00:00
include A few of the issue I have been trying to track down and fix have been due to 2011-01-17 03:46:26 +00:00
lib Initial support for a DynamicLoader plugin on Linux. 2011-01-16 19:45:39 +00:00
lldb.xcodeproj A few of the issue I have been trying to track down and fix have been due to 2011-01-17 03:46:26 +00:00
resources lldb-41 and debugserver-126 are set in the Xcode projects. 2011-01-15 03:06:23 +00:00
scripts Fixed an error in the type map for "char **" that was a bad memory smasher. 2011-01-14 04:54:56 +00:00
source A few of the issue I have been trying to track down and fix have been due to 2011-01-17 03:46:26 +00:00
test A few of the issue I have been trying to track down and fix have been due to 2011-01-17 03:46:26 +00:00
tools lldb-41 and debugserver-126 are set in the Xcode projects. 2011-01-15 03:06:23 +00:00
utils The recent change in argument parsing is messing up the emacs lldb mode's capability to properly 2010-12-20 22:58:58 +00:00
www Apply patch from Bruce Mitchener to fix spelling errors. 2011-01-07 17:16:03 +00:00
INSTALL.txt You'll need to be running Mac OS X to get lldb to build right now. 2010-06-09 07:29:26 +00:00
LICENSE.TXT test commit 2010-06-09 03:55:24 +00:00
Makefile Ignore unknown pragmas. 2011-01-06 22:10:24 +00:00