[Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 27 18:03:26 PDT 2015

Try this out:

% svn commit
Sending        include/lldb/Symbol/ClangASTContext.h
Sending        include/lldb/Symbol/TypeSystem.h
Sending        lldb.xcodeproj/project.pbxproj
Sending        source/Plugins/SymbolFile/DWARF/CMakeLists.txt
Adding         source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
Adding         source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Adding         source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
Sending        source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
Sending        source/Plugins/SymbolFile/DWARF/DWARFDIE.h
Sending        source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Sending        source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Sending        source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
Sending        source/Symbol/ClangASTContext.cpp
Transmitting file data .............
Committed revision 246242.

It should address everything we talked about. Commit message for this was:

Made a new abstract class named "DWARFASTParser" which lives in "source/Plugins/SymbolFile/DWARF":

class DWARFASTParser
    virtual ~DWARFASTParser() {}

    virtual lldb::TypeSP
    ParseTypeFromDWARF (const lldb_private::SymbolContext& sc,
                        const DWARFDIE &die,
                        lldb_private::Log *log,
                        bool *type_is_new_ptr) = 0;

    virtual lldb_private::Function *
    ParseFunctionFromDWARF (const lldb_private::SymbolContext& sc,
                            const DWARFDIE &die) = 0;

    virtual bool
    CompleteTypeFromDWARF (const DWARFDIE &die,
                           lldb_private::Type *type,
                           lldb_private::CompilerType &clang_type) = 0;

    virtual lldb_private::CompilerDeclContext
    GetDeclContextForUIDFromDWARF (const DWARFDIE &die) = 0;

    virtual lldb_private::CompilerDeclContext
    GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) = 0;


We have one subclass named DWARFASTParserClang that implements all of the clang specific AST type parsing. This keeps all DWARF parsing in the DWARF plug-in. Moved all of the DWARF parsing code that was in ClangASTContext over into DWARFASTParserClang.

lldb_private::TypeSystem classes no longer have any DWARF parsing functions in them, but they can hand out a DWARFASTParser:

virtual DWARFASTParser *
GetDWARFParser ()
    return nullptr;

This keeps things clean and makes for easy merging when we have different AST's for different languages.

> On Aug 27, 2015, at 4:06 PM, dawn at burble.org wrote:
> On Thu, Aug 27, 2015 at 03:57:30PM -0700, Greg Clayton wrote:
>> I can probably clean this up by making a DWARFASTParser a plug-in type and move all DWARF parsing code over into it and place that inside the DWARF plug-in folder. I see if I can do that quick to get the code organization back to how we want it.
> Very cool!!  This is exactly what I was hoping for.  Thank you Greg!!!

More information about the lldb-commits mailing list