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

class DWARFASTParser
{
public:
    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.

llvm-svn: 246242
This commit is contained in:
Greg Clayton 2015-08-28 01:01:03 +00:00
parent b5288ba9d1
commit 261ac3f4b5
13 changed files with 3950 additions and 3826 deletions

View File

@ -29,16 +29,9 @@
#include "lldb/lldb-enumerations.h" #include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h" #include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h" #include "lldb/Core/ConstString.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/TypeSystem.h" #include "lldb/Symbol/TypeSystem.h"
// Forward definitions for DWARF plug-in for type parsing
class DWARFDebugInfoEntry;
class DWARFDIE;
class DWARFDIECollection;
namespace lldb_private { namespace lldb_private {
class Declaration; class Declaration;
@ -499,27 +492,8 @@ public:
return this; return this;
} }
lldb::TypeSP DWARFASTParser *
ParseTypeFromDWARF (const SymbolContext& sc, GetDWARFParser () override;
const DWARFDIE &die,
Log *log,
bool *type_is_new_ptr) override;
Function *
ParseFunctionFromDWARF (const SymbolContext& sc,
const DWARFDIE &die) override;
bool
CompleteTypeFromDWARF (const DWARFDIE &die,
lldb_private::Type *type,
CompilerType &clang_type) override;
CompilerDeclContext
GetDeclContextForUIDFromDWARF (const DWARFDIE &die) override;
CompilerDeclContext
GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) override;
//------------------------------------------------------------------ //------------------------------------------------------------------
// ClangASTContext callbacks for external source lookups. // ClangASTContext callbacks for external source lookups.
@ -539,9 +513,6 @@ public:
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets); llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets);
clang::NamespaceDecl *
ResolveNamespaceDIE (const DWARFDIE &die);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// CompilerDeclContext override functions // CompilerDeclContext override functions
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1089,6 +1060,13 @@ public:
return clang::QualType(); return clang::QualType();
} }
clang::ClassTemplateDecl *
ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
lldb::AccessType access_type,
const char *parent_name,
int tag_decl_kind,
const ClangASTContext::TemplateParameterInfos &template_param_infos);
protected: protected:
static clang::QualType static clang::QualType
GetQualType (void *type) GetQualType (void *type)
@ -1106,109 +1084,6 @@ protected:
return clang::QualType(); return clang::QualType();
} }
struct LayoutInfo
{
LayoutInfo () :
bit_size(0),
alignment(0),
field_offsets(),
base_offsets(),
vbase_offsets()
{
}
uint64_t bit_size;
uint64_t alignment;
llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> vbase_offsets;
};
typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo> RecordDeclToLayoutMap;
// DWARF parsing functions
bool
ParseTemplateDIE (const DWARFDIE &die,
ClangASTContext::TemplateParameterInfos &template_param_infos);
bool
ParseTemplateParameterInfos (const DWARFDIE &parent_die,
ClangASTContext::TemplateParameterInfos &template_param_infos);
clang::ClassTemplateDecl *
ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
lldb::AccessType access_type,
const char *parent_name,
int tag_decl_kind,
const ClangASTContext::TemplateParameterInfos &template_param_infos);
class DelayedAddObjCClassProperty;
typedef std::vector <DelayedAddObjCClassProperty> DelayedPropertyList;
size_t
ParseChildMembers (const lldb_private::SymbolContext& sc,
const DWARFDIE &die,
lldb_private::CompilerType &class_clang_type,
const lldb::LanguageType class_language,
std::vector<clang::CXXBaseSpecifier *>& base_classes,
std::vector<int>& member_accessibilities,
DWARFDIECollection& member_function_dies,
DelayedPropertyList& delayed_properties,
lldb::AccessType &default_accessibility,
bool &is_a_class,
LayoutInfo &layout_info);
size_t
ParseChildParameters (const lldb_private::SymbolContext& sc,
clang::DeclContext *containing_decl_ctx,
const DWARFDIE &parent_die,
bool skip_artificial,
bool &is_static,
bool &is_variadic,
std::vector<lldb_private::CompilerType>& function_args,
std::vector<clang::ParmVarDecl*>& function_param_decls,
unsigned &type_quals);
void
ParseChildArrayInfo (const lldb_private::SymbolContext& sc,
const DWARFDIE &parent_die,
int64_t& first_index,
std::vector<uint64_t>& element_orders,
uint32_t& byte_stride,
uint32_t& bit_stride);
size_t
ParseChildEnumerators (const SymbolContext& sc,
lldb_private::CompilerType &clang_type,
bool is_signed,
uint32_t enumerator_byte_size,
const DWARFDIE &parent_die);
clang::DeclContext *
GetClangDeclContextForDIE (const DWARFDIE &die);
clang::DeclContext *
GetClangDeclContextContainingDIE (const DWARFDIE &die,
DWARFDIE *decl_ctx_die);
bool
CopyUniqueClassMethodTypes (const DWARFDIE &src_class_die,
const DWARFDIE &dst_class_die,
Type *class_type,
DWARFDIECollection &failures);
clang::DeclContext *
GetCachedClangDeclContextForDIE (const DWARFDIE &die);
void
LinkDeclContextToDIE (clang::DeclContext *decl_ctx,
const DWARFDIE &die);
typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;
typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet> DeclContextToDIEMap;
//------------------------------------------------------------------ //------------------------------------------------------------------
// Classes that inherit from ClangASTContext can see and modify these // Classes that inherit from ClangASTContext can see and modify these
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -1225,18 +1100,12 @@ protected:
std::unique_ptr<clang::IdentifierTable> m_identifier_table_ap; std::unique_ptr<clang::IdentifierTable> m_identifier_table_ap;
std::unique_ptr<clang::SelectorTable> m_selector_table_ap; std::unique_ptr<clang::SelectorTable> m_selector_table_ap;
std::unique_ptr<clang::Builtin::Context> m_builtins_ap; std::unique_ptr<clang::Builtin::Context> m_builtins_ap;
std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
CompleteTagDeclCallback m_callback_tag_decl; CompleteTagDeclCallback m_callback_tag_decl;
CompleteObjCInterfaceDeclCallback m_callback_objc_decl; CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
void * m_callback_baton; void * m_callback_baton;
uint32_t m_pointer_byte_size; uint32_t m_pointer_byte_size;
bool m_ast_owned; bool m_ast_owned;
// DWARF Parsing related ivars
RecordDeclToLayoutMap m_record_decl_to_layout_map;
DIEToDeclContextMap m_die_to_decl_ctx;
DeclContextToDIEMap m_decl_ctx_to_die;
clang::TranslationUnitDecl * m_clang_tu_decl;
private: private:
//------------------------------------------------------------------ //------------------------------------------------------------------

View File

@ -19,6 +19,7 @@
#include "clang/AST/Type.h" #include "clang/AST/Type.h"
class DWARFDIE; class DWARFDIE;
class DWARFASTParser;
namespace lldb_private { namespace lldb_private {
@ -38,37 +39,10 @@ public:
virtual ClangASTContext * virtual ClangASTContext *
AsClangASTContext() = 0; AsClangASTContext() = 0;
//---------------------------------------------------------------------- virtual DWARFASTParser *
// DWARF type parsing GetDWARFParser ()
//----------------------------------------------------------------------
virtual lldb::TypeSP
ParseTypeFromDWARF (const SymbolContext& sc,
const DWARFDIE &die,
Log *log,
bool *type_is_new_ptr) = 0;
virtual Function *
ParseFunctionFromDWARF (const SymbolContext& sc,
const DWARFDIE &die) = 0;
virtual bool
CompleteTypeFromDWARF (const DWARFDIE &die,
lldb_private::Type *type,
CompilerType &clang_type)
{ {
return false; return nullptr;
}
virtual CompilerDeclContext
GetDeclContextForUIDFromDWARF (const DWARFDIE &die)
{
return CompilerDeclContext();
}
virtual CompilerDeclContext
GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die)
{
return CompilerDeclContext();
} }
virtual SymbolFile * virtual SymbolFile *

View File

@ -559,6 +559,7 @@
2697A39315E404B1003E682C /* OptionValueArch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A39215E404B1003E682C /* OptionValueArch.cpp */; }; 2697A39315E404B1003E682C /* OptionValueArch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A39215E404B1003E682C /* OptionValueArch.cpp */; };
2697A54D133A6305004E4240 /* PlatformDarwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A54B133A6305004E4240 /* PlatformDarwin.cpp */; }; 2697A54D133A6305004E4240 /* PlatformDarwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A54B133A6305004E4240 /* PlatformDarwin.cpp */; };
2698699B15E6CBD0002415FF /* OperatingSystemPython.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2698699815E6CBD0002415FF /* OperatingSystemPython.cpp */; }; 2698699B15E6CBD0002415FF /* OperatingSystemPython.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2698699815E6CBD0002415FF /* OperatingSystemPython.cpp */; };
269DDD4A1B8FD1C300D0DBD8 /* DWARFASTParserClang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 269DDD481B8FD1C300D0DBD8 /* DWARFASTParserClang.cpp */; settings = {ASSET_TAGS = (); }; };
26A527C114E24F5F00F3A14A /* ProcessMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BD14E24F5F00F3A14A /* ProcessMachCore.cpp */; }; 26A527C114E24F5F00F3A14A /* ProcessMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BD14E24F5F00F3A14A /* ProcessMachCore.cpp */; };
26A527C314E24F5F00F3A14A /* ThreadMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */; }; 26A527C314E24F5F00F3A14A /* ThreadMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */; };
26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C6886E137880C400407EDF /* RegisterValue.cpp */; }; 26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C6886E137880C400407EDF /* RegisterValue.cpp */; };
@ -1721,6 +1722,9 @@
2697A54C133A6305004E4240 /* PlatformDarwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformDarwin.h; sourceTree = "<group>"; }; 2697A54C133A6305004E4240 /* PlatformDarwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformDarwin.h; sourceTree = "<group>"; };
2698699815E6CBD0002415FF /* OperatingSystemPython.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OperatingSystemPython.cpp; sourceTree = "<group>"; }; 2698699815E6CBD0002415FF /* OperatingSystemPython.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OperatingSystemPython.cpp; sourceTree = "<group>"; };
2698699915E6CBD0002415FF /* OperatingSystemPython.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OperatingSystemPython.h; sourceTree = "<group>"; }; 2698699915E6CBD0002415FF /* OperatingSystemPython.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OperatingSystemPython.h; sourceTree = "<group>"; };
269DDD451B8FD01A00D0DBD8 /* DWARFASTParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFASTParser.h; sourceTree = "<group>"; };
269DDD481B8FD1C300D0DBD8 /* DWARFASTParserClang.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFASTParserClang.cpp; sourceTree = "<group>"; };
269DDD491B8FD1C300D0DBD8 /* DWARFASTParserClang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFASTParserClang.h; sourceTree = "<group>"; };
269FF07D12494F7D00225026 /* FuncUnwinders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FuncUnwinders.h; path = include/lldb/Symbol/FuncUnwinders.h; sourceTree = "<group>"; }; 269FF07D12494F7D00225026 /* FuncUnwinders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FuncUnwinders.h; path = include/lldb/Symbol/FuncUnwinders.h; sourceTree = "<group>"; };
269FF07F12494F8E00225026 /* UnwindPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindPlan.h; path = include/lldb/Symbol/UnwindPlan.h; sourceTree = "<group>"; }; 269FF07F12494F8E00225026 /* UnwindPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindPlan.h; path = include/lldb/Symbol/UnwindPlan.h; sourceTree = "<group>"; };
269FF08112494FC200225026 /* UnwindTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindTable.h; path = include/lldb/Symbol/UnwindTable.h; sourceTree = "<group>"; }; 269FF08112494FC200225026 /* UnwindTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindTable.h; path = include/lldb/Symbol/UnwindTable.h; sourceTree = "<group>"; };
@ -3092,6 +3096,9 @@
children = ( children = (
260C89B310F57C5600BB2B04 /* DWARFAbbreviationDeclaration.cpp */, 260C89B310F57C5600BB2B04 /* DWARFAbbreviationDeclaration.cpp */,
260C89B410F57C5600BB2B04 /* DWARFAbbreviationDeclaration.h */, 260C89B410F57C5600BB2B04 /* DWARFAbbreviationDeclaration.h */,
269DDD451B8FD01A00D0DBD8 /* DWARFASTParser.h */,
269DDD491B8FD1C300D0DBD8 /* DWARFASTParserClang.h */,
269DDD481B8FD1C300D0DBD8 /* DWARFASTParserClang.cpp */,
260C89B610F57C5600BB2B04 /* DWARFAttribute.h */, 260C89B610F57C5600BB2B04 /* DWARFAttribute.h */,
266E829C1B8E542C008FCA06 /* DWARFAttribute.cpp */, 266E829C1B8E542C008FCA06 /* DWARFAttribute.cpp */,
260C89B710F57C5600BB2B04 /* DWARFCompileUnit.cpp */, 260C89B710F57C5600BB2B04 /* DWARFCompileUnit.cpp */,
@ -6145,6 +6152,7 @@
26B75B441AD6E29A001F7A57 /* MipsLinuxSignals.cpp in Sources */, 26B75B441AD6E29A001F7A57 /* MipsLinuxSignals.cpp in Sources */,
2689003E13353E0400698AC0 /* FileSpecList.cpp in Sources */, 2689003E13353E0400698AC0 /* FileSpecList.cpp in Sources */,
2689004113353E0400698AC0 /* Listener.cpp in Sources */, 2689004113353E0400698AC0 /* Listener.cpp in Sources */,
269DDD4A1B8FD1C300D0DBD8 /* DWARFASTParserClang.cpp in Sources */,
2689004213353E0400698AC0 /* Log.cpp in Sources */, 2689004213353E0400698AC0 /* Log.cpp in Sources */,
2689004313353E0400698AC0 /* Mangled.cpp in Sources */, 2689004313353E0400698AC0 /* Mangled.cpp in Sources */,
2689004413353E0400698AC0 /* Module.cpp in Sources */, 2689004413353E0400698AC0 /* Module.cpp in Sources */,

View File

@ -2,6 +2,7 @@ set(LLVM_NO_RTTI 1)
add_lldb_library(lldbPluginSymbolFileDWARF add_lldb_library(lldbPluginSymbolFileDWARF
DWARFAbbreviationDeclaration.cpp DWARFAbbreviationDeclaration.cpp
DWARFASTParserClang.cpp
DWARFAttribute.cpp DWARFAttribute.cpp
DWARFCompileUnit.cpp DWARFCompileUnit.cpp
DWARFDataExtractor.cpp DWARFDataExtractor.cpp

View File

@ -0,0 +1,48 @@
//===-- DWARFASTParser.h ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef SymbolFileDWARF_DWARFASTParser_h_
#define SymbolFileDWARF_DWARFASTParser_h_
#include "DWARFDefines.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/CompilerDeclContext.h"
class DWARFDIE;
class DWARFASTParser
{
public:
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;
};
#endif // SymbolFileDWARF_DWARFASTParser_h_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,169 @@
//===-- DWARFASTParserClang.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef SymbolFileDWARF_DWARFASTParserClang_h_
#define SymbolFileDWARF_DWARFASTParserClang_h_
#include "DWARFDefines.h"
#include "DWARFASTParser.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "clang/AST/CharUnits.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/ClangASTContext.h"
class DWARFDebugInfoEntry;
class DWARFDIECollection;
class DWARFASTParserClang : public DWARFASTParser
{
public:
DWARFASTParserClang (lldb_private::ClangASTContext &ast);
virtual ~DWARFASTParserClang ();
lldb::TypeSP
ParseTypeFromDWARF (const lldb_private::SymbolContext& sc,
const DWARFDIE &die,
lldb_private::Log *log,
bool *type_is_new_ptr) override;
virtual lldb_private::Function *
ParseFunctionFromDWARF (const lldb_private::SymbolContext& sc,
const DWARFDIE &die) override;
virtual bool
CompleteTypeFromDWARF (const DWARFDIE &die,
lldb_private::Type *type,
lldb_private::CompilerType &clang_type) override;
virtual lldb_private::CompilerDeclContext
GetDeclContextForUIDFromDWARF (const DWARFDIE &die) override;
virtual lldb_private::CompilerDeclContext
GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) override;
bool
LayoutRecordType(const clang::RecordDecl *record_decl,
uint64_t &bit_size,
uint64_t &alignment,
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets);
protected:
class DelayedAddObjCClassProperty;
typedef std::vector <DelayedAddObjCClassProperty> DelayedPropertyList;
struct LayoutInfo
{
LayoutInfo () :
bit_size(0),
alignment(0),
field_offsets(),
base_offsets(),
vbase_offsets()
{
}
uint64_t bit_size;
uint64_t alignment;
llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> vbase_offsets;
};
clang::NamespaceDecl *
ResolveNamespaceDIE (const DWARFDIE &die);
typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo> RecordDeclToLayoutMap;
bool
ParseTemplateDIE (const DWARFDIE &die,
lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
bool
ParseTemplateParameterInfos (const DWARFDIE &parent_die,
lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
size_t
ParseChildMembers (const lldb_private::SymbolContext& sc,
const DWARFDIE &die,
lldb_private::CompilerType &class_clang_type,
const lldb::LanguageType class_language,
std::vector<clang::CXXBaseSpecifier *>& base_classes,
std::vector<int>& member_accessibilities,
DWARFDIECollection& member_function_dies,
DelayedPropertyList& delayed_properties,
lldb::AccessType &default_accessibility,
bool &is_a_class,
LayoutInfo &layout_info);
size_t
ParseChildParameters (const lldb_private::SymbolContext& sc,
clang::DeclContext *containing_decl_ctx,
const DWARFDIE &parent_die,
bool skip_artificial,
bool &is_static,
bool &is_variadic,
std::vector<lldb_private::CompilerType>& function_args,
std::vector<clang::ParmVarDecl*>& function_param_decls,
unsigned &type_quals);
void
ParseChildArrayInfo (const lldb_private::SymbolContext& sc,
const DWARFDIE &parent_die,
int64_t& first_index,
std::vector<uint64_t>& element_orders,
uint32_t& byte_stride,
uint32_t& bit_stride);
size_t
ParseChildEnumerators (const lldb_private::SymbolContext& sc,
lldb_private::CompilerType &clang_type,
bool is_signed,
uint32_t enumerator_byte_size,
const DWARFDIE &parent_die);
clang::DeclContext *
GetClangDeclContextForDIE (const DWARFDIE &die);
clang::DeclContext *
GetClangDeclContextContainingDIE (const DWARFDIE &die,
DWARFDIE *decl_ctx_die);
bool
CopyUniqueClassMethodTypes (const DWARFDIE &src_class_die,
const DWARFDIE &dst_class_die,
lldb_private::Type *class_type,
DWARFDIECollection &failures);
clang::DeclContext *
GetCachedClangDeclContextForDIE (const DWARFDIE &die);
void
LinkDeclContextToDIE (clang::DeclContext *decl_ctx,
const DWARFDIE &die);
typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;
typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet> DeclContextToDIEMap;
lldb_private::ClangASTContext &m_ast;
DIEToDeclContextMap m_die_to_decl_ctx;
DeclContextToDIEMap m_decl_ctx_to_die;
RecordDeclToLayoutMap m_record_decl_to_layout_map;
};
#endif // SymbolFileDWARF_DWARFASTParserClang_h_

View File

@ -323,6 +323,16 @@ DWARFDIE::GetTypeSystem () const
return nullptr; return nullptr;
} }
DWARFASTParser *
DWARFDIE::GetDWARFParser () const
{
lldb_private::TypeSystem *type_system = GetTypeSystem ();
if (type_system)
return type_system->GetDWARFParser();
else
return nullptr;
}
bool bool
DWARFDIE::IsStructOrClass () const DWARFDIE::IsStructOrClass () const
{ {

View File

@ -13,6 +13,7 @@
#include "lldb/lldb-types.h" #include "lldb/lldb-types.h"
#include "lldb/Core/dwarf.h" #include "lldb/Core/dwarf.h"
class DWARFASTParser;
class DWARFAttributes; class DWARFAttributes;
class DWARFCompileUnit; class DWARFCompileUnit;
class DWARFDebugInfoEntry; class DWARFDebugInfoEntry;
@ -97,6 +98,9 @@ public:
lldb_private::TypeSystem * lldb_private::TypeSystem *
GetTypeSystem () const; GetTypeSystem () const;
DWARFASTParser *
GetDWARFParser () const;
void void
Set (DWARFCompileUnit *cu, DWARFDebugInfoEntry *die) Set (DWARFCompileUnit *cu, DWARFDebugInfoEntry *die)
{ {

View File

@ -57,6 +57,7 @@
#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/CPPLanguageRuntime.h" #include "lldb/Target/CPPLanguageRuntime.h"
#include "DWARFASTParser.h"
#include "DWARFCompileUnit.h" #include "DWARFCompileUnit.h"
#include "DWARFDebugAbbrev.h" #include "DWARFDebugAbbrev.h"
#include "DWARFDebugAranges.h" #include "DWARFDebugAranges.h"
@ -1014,7 +1015,9 @@ SymbolFileDWARF::ParseCompileUnitFunction (const SymbolContext& sc, const DWARFD
if (type_system) if (type_system)
{ {
return type_system->ParseFunctionFromDWARF(sc, die); DWARFASTParser *dwarf_ast = type_system->GetDWARFParser();
if (dwarf_ast)
return dwarf_ast->ParseFunctionFromDWARF(sc, die);
} }
} }
return nullptr; return nullptr;
@ -1381,9 +1384,9 @@ SymbolFileDWARF::GetDeclContextForUID (lldb::user_id_t type_uid)
DWARFDIE die = debug_info->GetDIE(type_uid); DWARFDIE die = debug_info->GetDIE(type_uid);
if (die) if (die)
{ {
TypeSystem *type_system = die.GetTypeSystem(); DWARFASTParser *dwarf_ast = die.GetDWARFParser();
if (type_system) if (dwarf_ast)
return type_system->GetDeclContextForUIDFromDWARF(die); return dwarf_ast->GetDeclContextForUIDFromDWARF(die);
} }
} }
} }
@ -1401,9 +1404,9 @@ SymbolFileDWARF::GetDeclContextContainingUID (lldb::user_id_t type_uid)
DWARFDIE die = debug_info->GetDIE(type_uid); DWARFDIE die = debug_info->GetDIE(type_uid);
if (die) if (die)
{ {
TypeSystem *type_system = die.GetTypeSystem(); DWARFASTParser *dwarf_ast = die.GetDWARFParser();
if (type_system) if (dwarf_ast)
return type_system->GetDeclContextContainingUIDFromDWARF(die); return dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
} }
} }
} }
@ -1521,10 +1524,9 @@ SymbolFileDWARF::CompleteType (CompilerType &clang_type)
DWARFAttributes attributes; DWARFAttributes attributes;
TypeSystem *type_system = dwarf_die.GetTypeSystem(); DWARFASTParser *dwarf_ast = dwarf_die.GetDWARFParser();
if (dwarf_ast)
if (type_system) return dwarf_ast->CompleteTypeFromDWARF (dwarf_die, type, clang_type);
return type_system->CompleteTypeFromDWARF (dwarf_die, type, clang_type);
return false; return false;
} }
@ -2144,11 +2146,10 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const CompilerDec
if (parent_decl_ctx) if (parent_decl_ctx)
{ {
TypeSystem *type_system = die.GetTypeSystem(); DWARFASTParser *dwarf_ast = die.GetDWARFParser();
if (dwarf_ast)
if (type_system)
{ {
CompilerDeclContext actual_parent_decl_ctx = type_system->GetDeclContextContainingUIDFromDWARF (die); CompilerDeclContext actual_parent_decl_ctx = dwarf_ast->GetDeclContextContainingUIDFromDWARF (die);
if (!actual_parent_decl_ctx || actual_parent_decl_ctx != *parent_decl_ctx) if (!actual_parent_decl_ctx || actual_parent_decl_ctx != *parent_decl_ctx)
continue; continue;
} }
@ -2414,11 +2415,10 @@ SymbolFileDWARF::DIEInDeclContext (const CompilerDeclContext *decl_ctx,
if (die) if (die)
{ {
TypeSystem *type_system = die.GetTypeSystem(); DWARFASTParser *dwarf_ast = die.GetDWARFParser();
if (dwarf_ast)
if (type_system)
{ {
CompilerDeclContext actual_decl_ctx = type_system->GetDeclContextContainingUIDFromDWARF (die); CompilerDeclContext actual_decl_ctx = dwarf_ast->GetDeclContextContainingUIDFromDWARF (die);
if (actual_decl_ctx) if (actual_decl_ctx)
return actual_decl_ctx == *decl_ctx; return actual_decl_ctx == *decl_ctx;
} }
@ -2967,11 +2967,10 @@ SymbolFileDWARF::FindNamespace (const SymbolContext& sc,
if (!DIEInDeclContext (parent_decl_ctx, die)) if (!DIEInDeclContext (parent_decl_ctx, die))
continue; // The containing decl contexts don't match continue; // The containing decl contexts don't match
TypeSystem *type_system = die.GetTypeSystem(); DWARFASTParser *dwarf_ast = die.GetDWARFParser();
if (dwarf_ast)
if (type_system)
{ {
namespace_decl_ctx = type_system->GetDeclContextForUIDFromDWARF (die); namespace_decl_ctx = dwarf_ast->GetDeclContextForUIDFromDWARF (die);
if (namespace_decl_ctx) if (namespace_decl_ctx)
break; break;
} }
@ -3525,13 +3524,17 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, const DWARFDIE &die, bool *
if (type_system) if (type_system)
{ {
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO); DWARFASTParser *dwarf_ast = type_system->GetDWARFParser();
type_sp = type_system->ParseTypeFromDWARF (sc, die, log, type_is_new_ptr); if (dwarf_ast)
if (type_sp)
{ {
TypeList* type_list = GetTypeList(); Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
if (type_list) type_sp = dwarf_ast->ParseTypeFromDWARF (sc, die, log, type_is_new_ptr);
type_list->Insert(type_sp); if (type_sp)
{
TypeList* type_list = GetTypeList();
if (type_list)
type_list->Insert(type_sp);
}
} }
} }
} }

View File

@ -21,8 +21,6 @@
#include "clang/AST/CharUnits.h" #include "clang/AST/CharUnits.h"
#include "clang/AST/ExternalASTSource.h" #include "clang/AST/ExternalASTSource.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h" #include "lldb/Core/ClangForward.h"
@ -69,7 +67,8 @@ public:
friend class SymbolFileDWARFDebugMap; friend class SymbolFileDWARFDebugMap;
friend class DebugMapModule; friend class DebugMapModule;
friend class DWARFCompileUnit; friend class DWARFCompileUnit;
friend class lldb_private::ClangASTContext; friend class DWARFASTParserClang;
//------------------------------------------------------------------ //------------------------------------------------------------------
// Static Functions // Static Functions
//------------------------------------------------------------------ //------------------------------------------------------------------

View File

@ -109,7 +109,7 @@ protected:
friend class DWARFCompileUnit; friend class DWARFCompileUnit;
friend class SymbolFileDWARF; friend class SymbolFileDWARF;
friend class DebugMapModule; friend class DebugMapModule;
friend class lldb_private::ClangASTContext; friend class DWARFASTParserClang;
struct OSOInfo struct OSOInfo
{ {
lldb::ModuleSP module_sp; lldb::ModuleSP module_sp;

File diff suppressed because it is too large Load Diff