hanchenye-llvm-project/lldb/source/API
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
..
Makefile Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
SBAddress.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBBlock.cpp Fixed SBFrame to properly check to make sure it has a valid m_opaque_sp object 2010-12-14 04:58:53 +00:00
SBBreakpoint.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBBreakpointLocation.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBBroadcaster.cpp Added a less than operator that will compare the internal opaque pointer values so SBBroadcaster objects can be contained in ordered containers or sorted. 2010-12-05 23:14:19 +00:00
SBCommandInterpreter.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBCommandReturnObject.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBCommunication.cpp More reverting of the EOF stuff as the API was changed which we don't want to 2010-12-04 02:39:47 +00:00
SBCompileUnit.cpp Fixed SBFrame to properly check to make sure it has a valid m_opaque_sp object 2010-12-14 04:58:53 +00:00
SBDebugger.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBError.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBEvent.cpp Fixed a crasher when trying to get event data flavors on events that don't 2010-12-05 19:21:02 +00:00
SBFileSpec.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBFrame.cpp Implemented a major overhaul of the way variables are handled 2011-01-13 08:53:35 +00:00
SBFunction.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBHostOS.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBInputReader.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBInstruction.cpp Added copy constructors and assignment operators to all lldb::SB* classes 2010-11-05 23:17:00 +00:00
SBInstructionList.cpp Added copy constructors and assignment operators to all lldb::SB* classes 2010-11-05 23:17:00 +00:00
SBLineEntry.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBListener.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBModule.cpp Added symbol table access through the module for now. We might need to expose 2010-12-07 05:40:31 +00:00
SBProcess.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBSourceManager.cpp Add test_display_source_python() test case to TestSourceManager.py which uses 2010-12-11 01:20:39 +00:00
SBStream.cpp Add test_display_source_python() test case to TestSourceManager.py which uses 2010-12-11 01:20:39 +00:00
SBStringList.cpp Added copy constructors and assignment operators to all lldb::SB* classes 2010-11-05 23:17:00 +00:00
SBSymbol.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBSymbolContext.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
SBSymbolContextList.cpp Added some missing API for address resolving within a module, and looking 2010-09-10 18:31:35 +00:00
SBTarget.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00
SBThread.cpp Added the following functions to SBThread to allow threads to be suspended when a process is resumed: 2011-01-12 02:25:42 +00:00
SBType.cpp 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
SBValue.cpp 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
SBValueList.cpp The LLDB API (lldb::SB*) is now thread safe! 2010-12-20 20:49:23 +00:00