summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h1
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp115
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h10
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp101
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h147
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h4
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h4
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp19
8 files changed, 271 insertions, 130 deletions
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
index ffa1c2627e6..eb303ad3329 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
@@ -18,6 +18,7 @@
#ifndef LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBSYMUID_H
#define LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBSYMUID_H
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/Support/Compiler.h"
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
index 55de9662592..c36c49f4060 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
@@ -10,16 +10,18 @@
#include "PdbUtil.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/lldb-enumerations.h"
+
using namespace lldb_private;
using namespace lldb_private::npdb;
using namespace llvm::codeview;
using namespace llvm::pdb;
-llvm::pdb::PDB_SymType
-lldb_private::npdb::CVSymToPDBSym(llvm::codeview::SymbolKind kind) {
+PDB_SymType lldb_private::npdb::CVSymToPDBSym(SymbolKind kind) {
switch (kind) {
case S_COMPILE3:
case S_OBJNAME:
@@ -71,7 +73,32 @@ lldb_private::npdb::CVSymToPDBSym(llvm::codeview::SymbolKind kind) {
return PDB_SymType::None;
}
-bool lldb_private::npdb::SymbolHasAddress(const llvm::codeview::CVSymbol &sym) {
+PDB_SymType lldb_private::npdb::CVTypeToPDBType(TypeLeafKind kind) {
+ switch (kind) {
+ case LF_ARRAY:
+ return PDB_SymType::ArrayType;
+ case LF_ARGLIST:
+ return PDB_SymType::FunctionSig;
+ case LF_BCLASS:
+ return PDB_SymType::BaseClass;
+ case LF_BINTERFACE:
+ return PDB_SymType::BaseInterface;
+ case LF_CLASS:
+ case LF_STRUCTURE:
+ case LF_INTERFACE:
+ case LF_UNION:
+ return PDB_SymType::UDT;
+ case LF_POINTER:
+ return PDB_SymType::PointerType;
+ case LF_ENUM:
+ return PDB_SymType::Enum;
+ default:
+ lldbassert(false && "Invalid type record kind!");
+ }
+ return PDB_SymType::None;
+}
+
+bool lldb_private::npdb::SymbolHasAddress(const CVSymbol &sym) {
switch (sym.kind()) {
case S_GPROC32:
case S_LPROC32:
@@ -98,7 +125,7 @@ bool lldb_private::npdb::SymbolHasAddress(const llvm::codeview::CVSymbol &sym) {
}
}
-bool lldb_private::npdb::SymbolIsCode(const llvm::codeview::CVSymbol &sym) {
+bool lldb_private::npdb::SymbolIsCode(const CVSymbol &sym) {
switch (sym.kind()) {
case S_GPROC32:
case S_LPROC32:
@@ -156,8 +183,7 @@ SegmentOffset GetSegmentAndOffset<ThreadLocalDataSym>(const CVSymbol &sym) {
return {record.Segment, record.DataOffset};
}
-SegmentOffset
-lldb_private::npdb::GetSegmentAndOffset(const llvm::codeview::CVSymbol &sym) {
+SegmentOffset lldb_private::npdb::GetSegmentAndOffset(const CVSymbol &sym) {
switch (sym.kind()) {
case S_GPROC32:
case S_LPROC32:
@@ -229,8 +255,8 @@ GetSegmentOffsetAndLength<CoffGroupSym>(const CVSymbol &sym) {
return SegmentOffsetLength{record.Segment, record.Offset, record.Size};
}
-SegmentOffsetLength lldb_private::npdb::GetSegmentOffsetAndLength(
- const llvm::codeview::CVSymbol &sym) {
+SegmentOffsetLength
+lldb_private::npdb::GetSegmentOffsetAndLength(const CVSymbol &sym) {
switch (sym.kind()) {
case S_GPROC32:
case S_LPROC32:
@@ -256,3 +282,76 @@ SegmentOffsetLength lldb_private::npdb::GetSegmentOffsetAndLength(
}
return {0, 0, 0};
}
+
+bool lldb_private::npdb::IsForwardRefUdt(CVType cvt) {
+ ClassRecord cr;
+ UnionRecord ur;
+ EnumRecord er;
+ switch (cvt.kind()) {
+ case LF_CLASS:
+ case LF_STRUCTURE:
+ case LF_INTERFACE:
+ llvm::cantFail(TypeDeserializer::deserializeAs<ClassRecord>(cvt, cr));
+ return cr.isForwardRef();
+ case LF_UNION:
+ llvm::cantFail(TypeDeserializer::deserializeAs<UnionRecord>(cvt, ur));
+ return ur.isForwardRef();
+ case LF_ENUM:
+ llvm::cantFail(TypeDeserializer::deserializeAs<EnumRecord>(cvt, er));
+ return er.isForwardRef();
+ default:
+ return false;
+ }
+}
+
+lldb::AccessType
+lldb_private::npdb::TranslateMemberAccess(MemberAccess access) {
+ switch (access) {
+ case MemberAccess::Private:
+ return lldb::eAccessPrivate;
+ case MemberAccess::Protected:
+ return lldb::eAccessProtected;
+ case MemberAccess::Public:
+ return lldb::eAccessPublic;
+ case MemberAccess::None:
+ return lldb::eAccessNone;
+ }
+ llvm_unreachable("unreachable");
+}
+
+TypeIndex lldb_private::npdb::GetFieldListIndex(CVType cvt) {
+ switch (cvt.kind()) {
+ case LF_CLASS:
+ case LF_STRUCTURE:
+ case LF_INTERFACE: {
+ ClassRecord cr;
+ cantFail(TypeDeserializer::deserializeAs<ClassRecord>(cvt, cr));
+ return cr.FieldList;
+ }
+ case LF_UNION: {
+ UnionRecord ur;
+ cantFail(TypeDeserializer::deserializeAs<UnionRecord>(cvt, ur));
+ return ur.FieldList;
+ }
+ case LF_ENUM: {
+ EnumRecord er;
+ cantFail(TypeDeserializer::deserializeAs<EnumRecord>(cvt, er));
+ return er.FieldList;
+ }
+ default:
+ llvm_unreachable("Unreachable!");
+ }
+}
+
+llvm::StringRef lldb_private::npdb::DropNameScope(llvm::StringRef name) {
+ // Not all PDB names can be parsed with CPlusPlusNameParser.
+ // E.g. it fails on names containing `anonymous namespace'.
+ // So we simply drop everything before '::'
+
+ auto offset = name.rfind("::");
+ if (offset == llvm::StringRef::npos)
+ return name;
+ assert(offset + 2 <= name.size());
+
+ return name.substr(offset + 2);
+} \ No newline at end of file
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
index 61b164931e4..1ba33ae6025 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
@@ -10,6 +10,8 @@
#ifndef LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBUTIL_H
#define LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBUTIL_H
+#include "lldb/lldb-enumerations.h"
+
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
@@ -35,6 +37,7 @@ struct SegmentOffsetLength {
};
llvm::pdb::PDB_SymType CVSymToPDBSym(llvm::codeview::SymbolKind kind);
+llvm::pdb::PDB_SymType CVTypeToPDBType(llvm::codeview::TypeLeafKind kind);
bool SymbolHasAddress(const llvm::codeview::CVSymbol &sym);
bool SymbolIsCode(const llvm::codeview::CVSymbol &sym);
@@ -52,6 +55,13 @@ inline bool IsValidRecord(const llvm::codeview::ProcRefSym &sym) {
return sym.Module > 0;
}
+bool IsForwardRefUdt(llvm::codeview::CVType cvt);
+
+lldb::AccessType TranslateMemberAccess(llvm::codeview::MemberAccess access);
+llvm::codeview::TypeIndex GetFieldListIndex(llvm::codeview::CVType cvt);
+
+llvm::StringRef DropNameScope(llvm::StringRef name);
+
} // namespace npdb
} // namespace lldb_private
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index c8b8d380327..748c0de6258 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -9,8 +9,6 @@
#include "SymbolFileNativePDB.h"
-#include "clang/Lex/Lexer.h"
-
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/CompileUnit.h"
@@ -151,10 +149,9 @@ void SymbolFileNativePDB::Terminate() {
PluginManager::UnregisterPlugin(CreateInstance);
}
-void SymbolFileNativePDB::DebuggerInitialize(lldb_private::Debugger &debugger) {
-}
+void SymbolFileNativePDB::DebuggerInitialize(Debugger &debugger) {}
-lldb_private::ConstString SymbolFileNativePDB::GetPluginNameStatic() {
+ConstString SymbolFileNativePDB::GetPluginNameStatic() {
static ConstString g_name("native-pdb");
return g_name;
}
@@ -163,12 +160,11 @@ const char *SymbolFileNativePDB::GetPluginDescriptionStatic() {
return "Microsoft PDB debug symbol cross-platform file reader.";
}
-lldb_private::SymbolFile *
-SymbolFileNativePDB::CreateInstance(lldb_private::ObjectFile *obj_file) {
+SymbolFile *SymbolFileNativePDB::CreateInstance(ObjectFile *obj_file) {
return new SymbolFileNativePDB(obj_file);
}
-SymbolFileNativePDB::SymbolFileNativePDB(lldb_private::ObjectFile *object_file)
+SymbolFileNativePDB::SymbolFileNativePDB(ObjectFile *object_file)
: SymbolFile(object_file) {}
SymbolFileNativePDB::~SymbolFileNativePDB() {}
@@ -260,7 +256,7 @@ lldb::FunctionSP SymbolFileNativePDB::CreateFunction(PdbSymUid func_uid,
if (!func_range.GetBaseAddress().IsValid())
return nullptr;
- lldb_private::Type *func_type = nullptr;
+ Type *func_type = nullptr;
// FIXME: Resolve types and mangled names.
PdbSymUid sig_uid =
@@ -287,7 +283,7 @@ SymbolFileNativePDB::CreateCompileUnit(const CompilandIndexItem &cci) {
llvm::StringRef source_file_name =
m_index->compilands().GetMainSourceFile(cci);
- lldb_private::FileSpec fs(source_file_name, false);
+ FileSpec fs(source_file_name, false);
CompUnitSP cu_sp =
std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr, fs,
@@ -333,8 +329,8 @@ lldb::CompUnitSP SymbolFileNativePDB::ParseCompileUnitAtIndex(uint32_t index) {
return GetOrCreateCompileUnit(item);
}
-lldb::LanguageType SymbolFileNativePDB::ParseCompileUnitLanguage(
- const lldb_private::SymbolContext &sc) {
+lldb::LanguageType
+SymbolFileNativePDB::ParseCompileUnitLanguage(const SymbolContext &sc) {
// What fields should I expect to be filled out on the SymbolContext? Is it
// safe to assume that `sc.comp_unit` is valid?
if (!sc.comp_unit)
@@ -350,8 +346,7 @@ lldb::LanguageType SymbolFileNativePDB::ParseCompileUnitLanguage(
return TranslateLanguage(item->m_compile_opts->getLanguage());
}
-size_t SymbolFileNativePDB::ParseCompileUnitFunctions(
- const lldb_private::SymbolContext &sc) {
+size_t SymbolFileNativePDB::ParseCompileUnitFunctions(const SymbolContext &sc) {
lldbassert(sc.comp_unit);
return false;
}
@@ -366,10 +361,9 @@ static bool NeedsResolvedCompileUnit(uint32_t resolve_scope) {
return (resolve_scope & flags) != 0;
}
-uint32_t
-SymbolFileNativePDB::ResolveSymbolContext(const lldb_private::Address &addr,
- uint32_t resolve_scope,
- lldb_private::SymbolContext &sc) {
+uint32_t SymbolFileNativePDB::ResolveSymbolContext(const Address &addr,
+ uint32_t resolve_scope,
+ SymbolContext &sc) {
uint32_t resolved_flags = 0;
lldb::addr_t file_addr = addr.GetFileAddress();
@@ -444,8 +438,7 @@ static void TerminateLineSequence(LineTable &table,
table.InsertSequence(seq.release());
}
-bool SymbolFileNativePDB::ParseCompileUnitLineTable(
- const lldb_private::SymbolContext &sc) {
+bool SymbolFileNativePDB::ParseCompileUnitLineTable(const SymbolContext &sc) {
// Unfortunately LLDB is set up to parse the entire compile unit line table
// all at once, even if all it really needs is line info for a specific
// function. In the future it would be nice if it could set the sc.m_function
@@ -519,15 +512,13 @@ bool SymbolFileNativePDB::ParseCompileUnitLineTable(
return true;
}
-bool SymbolFileNativePDB::ParseCompileUnitDebugMacros(
- const lldb_private::SymbolContext &sc) {
+bool SymbolFileNativePDB::ParseCompileUnitDebugMacros(const SymbolContext &sc) {
// PDB doesn't contain information about macros
return false;
}
bool SymbolFileNativePDB::ParseCompileUnitSupportFiles(
- const lldb_private::SymbolContext &sc,
- lldb_private::FileSpecList &support_files) {
+ const SymbolContext &sc, FileSpecList &support_files) {
lldbassert(sc.comp_unit);
PdbSymUid comp_uid = PdbSymUid::fromOpaqueId(sc.comp_unit->GetID());
@@ -547,23 +538,20 @@ bool SymbolFileNativePDB::ParseCompileUnitSupportFiles(
}
bool SymbolFileNativePDB::ParseImportedModules(
- const lldb_private::SymbolContext &sc,
- std::vector<lldb_private::ConstString> &imported_modules) {
+ const SymbolContext &sc, std::vector<ConstString> &imported_modules) {
// PDB does not yet support module debug info
return false;
}
-size_t SymbolFileNativePDB::ParseFunctionBlocks(
- const lldb_private::SymbolContext &sc) {
+size_t SymbolFileNativePDB::ParseFunctionBlocks(const SymbolContext &sc) {
lldbassert(sc.comp_unit && sc.function);
return 0;
}
uint32_t SymbolFileNativePDB::FindFunctions(
- const lldb_private::ConstString &name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx,
+ const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
uint32_t name_type_mask, bool include_inlines, bool append,
- lldb_private::SymbolContextList &sc_list) {
+ SymbolContextList &sc_list) {
// For now we only support lookup by method name.
if (!(name_type_mask & eFunctionNameTypeMethod))
return 0;
@@ -583,7 +571,7 @@ uint32_t SymbolFileNativePDB::FindFunctions(
PdbSymUid cuid = PdbSymUid::makeCompilandId(proc);
CompilandIndexItem &cci = m_index->compilands().GetOrCreateCompiland(cuid);
- lldb_private::SymbolContext sc;
+ SymbolContext sc;
sc.comp_unit = GetOrCreateCompileUnit(cci).get();
sc.module_sp = sc.comp_unit->GetModule();
@@ -596,21 +584,50 @@ uint32_t SymbolFileNativePDB::FindFunctions(
return sc_list.GetSize();
}
-uint32_t
-SymbolFileNativePDB::FindFunctions(const lldb_private::RegularExpression &regex,
- bool include_inlines, bool append,
- lldb_private::SymbolContextList &sc_list) {
+uint32_t SymbolFileNativePDB::FindFunctions(const RegularExpression &regex,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list) {
+ return 0;
+}
+
+uint32_t SymbolFileNativePDB::FindTypes(
+ const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx, bool append,
+ uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeMap &types) {
+ return 0;
+}
+
+size_t
+SymbolFileNativePDB::FindTypes(const std::vector<CompilerContext> &context,
+ bool append, TypeMap &types) {
+ return 0;
+}
+
+size_t SymbolFileNativePDB::ParseTypes(const SymbolContext &sc) { return 0; }
+
+Type *SymbolFileNativePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
+ return nullptr;
+}
+
+bool SymbolFileNativePDB::CompleteType(CompilerType &compiler_type) {
+ return false;
+}
+
+size_t SymbolFileNativePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list) {
return 0;
}
-lldb_private::CompilerDeclContext SymbolFileNativePDB::FindNamespace(
- const lldb_private::SymbolContext &sc,
- const lldb_private::ConstString &name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx) {
+CompilerDeclContext
+SymbolFileNativePDB::FindNamespace(const SymbolContext &sc,
+ const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx) {
return {};
}
-lldb_private::TypeSystem *
+TypeSystem *
SymbolFileNativePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
auto type_system =
m_obj_file->GetModule()->GetTypeSystemForLanguage(language);
@@ -619,7 +636,7 @@ SymbolFileNativePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
return type_system;
}
-lldb_private::ConstString SymbolFileNativePDB::GetPluginName() {
+ConstString SymbolFileNativePDB::GetPluginName() {
static ConstString g_name("pdb");
return g_name;
}
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 1cd197b60d1..2a5b5471a1d 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -7,50 +7,49 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Plugins_SymbolFile_PDB_SymbolFileNativePDB_h_
-#define lldb_Plugins_SymbolFile_PDB_SymbolFileNativePDB_h_
+#ifndef LLDB_PLUGINS_SYMBOLFILE_NATIVEPDB_SYMBOLFILENATIVEPDB_H
+#define LLDB_PLUGINS_SYMBOLFILE_NATIVEPDB_SYMBOLFILENATIVEPDB_H
-#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Symbol/SymbolFile.h"
-#include "lldb/Symbol/VariableList.h"
-#include "lldb/Utility/UserID.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
-#include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "CompileUnitIndex.h"
#include "PdbIndex.h"
-#include <unordered_map>
+namespace clang {
+class TagDecl;
+}
namespace llvm {
-namespace pdb {
-class PDBFile;
-class PDBSymbol;
-class PDBSymbolCompiland;
-class PDBSymbolData;
-class PDBSymbolFunc;
-
-class DbiStream;
-class TpiStream;
-class TpiStream;
-class InfoStream;
-class PublicsStream;
-class GlobalsStream;
-class SymbolStream;
-class ModuleDebugStreamRef;
-} // namespace pdb
+namespace codeview {
+class ClassRecord;
+class EnumRecord;
+class ModifierRecord;
+class PointerRecord;
+struct UnionRecord;
+} // namespace codeview
} // namespace llvm
namespace lldb_private {
+class ClangASTImporter;
+
namespace npdb {
-class SymbolFileNativePDB : public lldb_private::SymbolFile {
+struct DeclStatus {
+ DeclStatus() = default;
+ DeclStatus(lldb::user_id_t uid, Type::ResolveStateTag status)
+ : uid(uid), status(status) {}
+ lldb::user_id_t uid = 0;
+ Type::ResolveStateTag status = Type::eResolveStateForward;
+};
+
+class SymbolFileNativePDB : public SymbolFile {
+ friend class UdtRecordCompleter;
+
public:
//------------------------------------------------------------------
// Static Functions
@@ -59,19 +58,18 @@ public:
static void Terminate();
- static void DebuggerInitialize(lldb_private::Debugger &debugger);
+ static void DebuggerInitialize(Debugger &debugger);
- static lldb_private::ConstString GetPluginNameStatic();
+ static ConstString GetPluginNameStatic();
static const char *GetPluginDescriptionStatic();
- static lldb_private::SymbolFile *
- CreateInstance(lldb_private::ObjectFile *obj_file);
+ static SymbolFile *CreateInstance(ObjectFile *obj_file);
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- SymbolFileNativePDB(lldb_private::ObjectFile *ofile);
+ SymbolFileNativePDB(ObjectFile *ofile);
~SymbolFileNativePDB() override;
@@ -87,70 +85,59 @@ public:
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
- lldb::LanguageType
- ParseCompileUnitLanguage(const lldb_private::SymbolContext &sc) override;
+ lldb::LanguageType ParseCompileUnitLanguage(const SymbolContext &sc) override;
- size_t
- ParseCompileUnitFunctions(const lldb_private::SymbolContext &sc) override;
+ size_t ParseCompileUnitFunctions(const SymbolContext &sc) override;
- bool
- ParseCompileUnitLineTable(const lldb_private::SymbolContext &sc) override;
+ bool ParseCompileUnitLineTable(const SymbolContext &sc) override;
- bool
- ParseCompileUnitDebugMacros(const lldb_private::SymbolContext &sc) override;
+ bool ParseCompileUnitDebugMacros(const SymbolContext &sc) override;
- bool ParseCompileUnitSupportFiles(
- const lldb_private::SymbolContext &sc,
- lldb_private::FileSpecList &support_files) override;
+ bool ParseCompileUnitSupportFiles(const SymbolContext &sc,
+ FileSpecList &support_files) override;
- bool ParseImportedModules(
- const lldb_private::SymbolContext &sc,
- std::vector<lldb_private::ConstString> &imported_modules) override;
+ bool
+ ParseImportedModules(const SymbolContext &sc,
+ std::vector<ConstString> &imported_modules) override;
- size_t ParseFunctionBlocks(const lldb_private::SymbolContext &sc) override;
+ size_t ParseFunctionBlocks(const SymbolContext &sc) override;
- size_t ParseTypes(const lldb_private::SymbolContext &sc) override {
+ size_t ParseTypes(const SymbolContext &sc) override;
+ size_t ParseVariablesForContext(const SymbolContext &sc) override {
return 0;
}
- size_t
- ParseVariablesForContext(const lldb_private::SymbolContext &sc) override {
- return 0;
- }
- lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override {
- return nullptr;
- }
- bool CompleteType(lldb_private::CompilerType &compiler_type) override {
- return false;
- }
- uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
- uint32_t resolve_scope,
- lldb_private::SymbolContext &sc) override;
+ Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
+ bool CompleteType(CompilerType &compiler_type) override;
+ uint32_t ResolveSymbolContext(const Address &so_addr, uint32_t resolve_scope,
+ SymbolContext &sc) override;
- virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- uint32_t type_mask,
- lldb_private::TypeList &type_list) override {
- return 0;
- }
+ size_t GetTypes(SymbolContextScope *sc_scope, uint32_t type_mask,
+ TypeList &type_list) override;
+
+ uint32_t FindFunctions(const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx,
+ uint32_t name_type_mask, bool include_inlines,
+ bool append, SymbolContextList &sc_list) override;
+
+ uint32_t FindFunctions(const RegularExpression &regex, bool include_inlines,
+ bool append, SymbolContextList &sc_list) override;
- uint32_t
- FindFunctions(const lldb_private::ConstString &name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx,
- uint32_t name_type_mask, bool include_inlines, bool append,
- lldb_private::SymbolContextList &sc_list) override;
+ uint32_t FindTypes(const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx, bool append,
+ uint32_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeMap &types) override;
- uint32_t FindFunctions(const lldb_private::RegularExpression &regex,
- bool include_inlines, bool append,
- lldb_private::SymbolContextList &sc_list) override;
+ size_t FindTypes(const std::vector<CompilerContext> &context, bool append,
+ TypeMap &types) override;
- lldb_private::TypeSystem *
- GetTypeSystemForLanguage(lldb::LanguageType language) override;
+ TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language) override;
- lldb_private::CompilerDeclContext FindNamespace(
- const lldb_private::SymbolContext &sc,
- const lldb_private::ConstString &name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
+ CompilerDeclContext
+ FindNamespace(const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx) override;
- lldb_private::ConstString GetPluginName() override;
+ ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 9a06a6a3344..76f1f98ab66 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -429,6 +429,10 @@ public:
return (Options & ClassOptions::ForwardReference) != ClassOptions::None;
}
+ bool isScoped() const {
+ return (Options & ClassOptions::Scoped) != ClassOptions::None;
+ }
+
uint16_t getMemberCount() const { return MemberCount; }
ClassOptions getOptions() const { return Options; }
TypeIndex getFieldList() const { return FieldList; }
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h b/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
index 00cc720336c..b76576a7a26 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
@@ -61,6 +61,10 @@ public:
Expected<codeview::TypeIndex>
findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
+ std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
+
+ codeview::CVType getType(codeview::TypeIndex Index);
+
BinarySubstreamRef getTypeRecordsSubstream() const;
Error commit();
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
index 96221f7d6ec..44781705bfa 100644
--- a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
@@ -11,6 +11,7 @@
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
+#include "llvm/DebugInfo/CodeView/RecordName.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
@@ -158,6 +159,20 @@ void TpiStream::buildHashMap() {
}
}
+std::vector<TypeIndex> TpiStream::findRecordsByName(StringRef Name) const {
+ uint32_t Bucket = hashStringV1(Name) % Header->NumHashBuckets;
+ if (Bucket > HashMap.size())
+ return {};
+
+ std::vector<TypeIndex> Result;
+ for (TypeIndex TI : HashMap[Bucket]) {
+ std::string ThisName = computeTypeName(*Types, TI);
+ if (ThisName == Name)
+ Result.push_back(TI);
+ }
+ return Result;
+}
+
bool TpiStream::supportsTypeLookup() const { return !HashMap.empty(); }
Expected<TypeIndex>
@@ -199,6 +214,10 @@ TpiStream::findFullDeclForForwardRef(TypeIndex ForwardRefTI) const {
return ForwardRefTI;
}
+codeview::CVType TpiStream::getType(codeview::TypeIndex Index) {
+ return Types->getType(Index);
+}
+
BinarySubstreamRef TpiStream::getTypeRecordsSubstream() const {
return TypeRecordsSubstream;
}
OpenPOWER on IntegriCloud