Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
Show All 18 Lines | |||||
#include "lldb/Symbol/CompileUnit.h" | #include "lldb/Symbol/CompileUnit.h" | ||||
#include "lldb/Symbol/LineTable.h" | #include "lldb/Symbol/LineTable.h" | ||||
#include "lldb/Symbol/ObjectFile.h" | #include "lldb/Symbol/ObjectFile.h" | ||||
#include "lldb/Symbol/SymbolContext.h" | #include "lldb/Symbol/SymbolContext.h" | ||||
#include "lldb/Symbol/SymbolVendor.h" | #include "lldb/Symbol/SymbolVendor.h" | ||||
#include "lldb/Symbol/TypeList.h" | #include "lldb/Symbol/TypeList.h" | ||||
#include "lldb/Symbol/TypeMap.h" | #include "lldb/Symbol/TypeMap.h" | ||||
#include "lldb/Symbol/Variable.h" | #include "lldb/Symbol/Variable.h" | ||||
#include "lldb/Utility/Log.h" | |||||
#include "lldb/Utility/RegularExpression.h" | #include "lldb/Utility/RegularExpression.h" | ||||
#include "llvm/DebugInfo/PDB/GenericError.h" | #include "llvm/DebugInfo/PDB/GenericError.h" | ||||
#include "llvm/DebugInfo/PDB/IPDBDataStream.h" | #include "llvm/DebugInfo/PDB/IPDBDataStream.h" | ||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" | #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" | ||||
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h" | #include "llvm/DebugInfo/PDB/IPDBLineNumber.h" | ||||
#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h" | #include "llvm/DebugInfo/PDB/IPDBSectionContrib.h" | ||||
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h" | #include "llvm/DebugInfo/PDB/IPDBSourceFile.h" | ||||
▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func, | ||||
FunctionSP func_sp = | FunctionSP func_sp = | ||||
std::make_shared<Function>(&comp_unit, pdb_func.getSymIndexId(), | std::make_shared<Function>(&comp_unit, pdb_func.getSymIndexId(), | ||||
func_type_uid, mangled, func_type, func_range); | func_type_uid, mangled, func_type, func_range); | ||||
comp_unit.AddFunction(func_sp); | comp_unit.AddFunction(func_sp); | ||||
LanguageType lang = ParseLanguage(comp_unit); | LanguageType lang = ParseLanguage(comp_unit); | ||||
TypeSystem *type_system = GetTypeSystemForLanguage(lang); | auto type_system_or_err = GetTypeSystemForLanguage(lang); | ||||
if (!type_system) | if (auto err = type_system_or_err.takeError()) { | ||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to parse PDBFunc"); | |||||
return nullptr; | return nullptr; | ||||
} | |||||
ClangASTContext *clang_type_system = | ClangASTContext *clang_type_system = | ||||
llvm::dyn_cast_or_null<ClangASTContext>(type_system); | llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | ||||
if (!clang_type_system) | if (!clang_type_system) | ||||
return nullptr; | return nullptr; | ||||
clang_type_system->GetPDBParser()->GetDeclForSymbol(pdb_func); | clang_type_system->GetPDBParser()->GetDeclForSymbol(pdb_func); | ||||
return func_sp.get(); | return func_sp.get(); | ||||
} | } | ||||
size_t SymbolFilePDB::ParseFunctions(CompileUnit &comp_unit) { | size_t SymbolFilePDB::ParseFunctions(CompileUnit &comp_unit) { | ||||
▲ Show 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | SymbolFilePDB::ParseVariablesForContext(const lldb_private::SymbolContext &sc) { | ||||
return num_added; | return num_added; | ||||
} | } | ||||
lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) { | lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) { | ||||
auto find_result = m_types.find(type_uid); | auto find_result = m_types.find(type_uid); | ||||
if (find_result != m_types.end()) | if (find_result != m_types.end()) | ||||
return find_result->second.get(); | return find_result->second.get(); | ||||
TypeSystem *type_system = | auto type_system_or_err = | ||||
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to ResolveTypeUID"); | |||||
return nullptr; | |||||
} | |||||
ClangASTContext *clang_type_system = | ClangASTContext *clang_type_system = | ||||
llvm::dyn_cast_or_null<ClangASTContext>(type_system); | llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | ||||
if (!clang_type_system) | if (!clang_type_system) | ||||
return nullptr; | return nullptr; | ||||
PDBASTParser *pdb = clang_type_system->GetPDBParser(); | PDBASTParser *pdb = clang_type_system->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return nullptr; | return nullptr; | ||||
auto pdb_type = m_session_up->getSymbolById(type_uid); | auto pdb_type = m_session_up->getSymbolById(type_uid); | ||||
if (pdb_type == nullptr) | if (pdb_type == nullptr) | ||||
Show All 11 Lines | llvm::Optional<SymbolFile::ArrayInfo> SymbolFilePDB::GetDynamicArrayInfoForUID( | ||||
lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) { | lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) { | ||||
return llvm::None; | return llvm::None; | ||||
} | } | ||||
bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) { | bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) { | ||||
std::lock_guard<std::recursive_mutex> guard( | std::lock_guard<std::recursive_mutex> guard( | ||||
GetObjectFile()->GetModule()->GetMutex()); | GetObjectFile()->GetModule()->GetMutex()); | ||||
ClangASTContext *clang_ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to get dynamic array info for UID"); | |||||
return false; | |||||
} | |||||
ClangASTContext *clang_ast_ctx = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_ast_ctx) | if (!clang_ast_ctx) | ||||
return false; | return false; | ||||
PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return false; | return false; | ||||
return pdb->CompleteTypeFromPDB(compiler_type); | return pdb->CompleteTypeFromPDB(compiler_type); | ||||
} | } | ||||
lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) { | lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) { | ||||
ClangASTContext *clang_ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to get decl for UID"); | |||||
return CompilerDecl(); | |||||
} | |||||
ClangASTContext *clang_ast_ctx = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_ast_ctx) | if (!clang_ast_ctx) | ||||
return CompilerDecl(); | return CompilerDecl(); | ||||
PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return CompilerDecl(); | return CompilerDecl(); | ||||
auto symbol = m_session_up->getSymbolById(uid); | auto symbol = m_session_up->getSymbolById(uid); | ||||
if (!symbol) | if (!symbol) | ||||
return CompilerDecl(); | return CompilerDecl(); | ||||
auto decl = pdb->GetDeclForSymbol(*symbol); | auto decl = pdb->GetDeclForSymbol(*symbol); | ||||
if (!decl) | if (!decl) | ||||
return CompilerDecl(); | return CompilerDecl(); | ||||
return CompilerDecl(clang_ast_ctx, decl); | return CompilerDecl(clang_ast_ctx, decl); | ||||
} | } | ||||
lldb_private::CompilerDeclContext | lldb_private::CompilerDeclContext | ||||
SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) { | SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) { | ||||
ClangASTContext *clang_ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to get DeclContext for UID"); | |||||
return CompilerDeclContext(); | |||||
} | |||||
ClangASTContext *clang_ast_ctx = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_ast_ctx) | if (!clang_ast_ctx) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
auto symbol = m_session_up->getSymbolById(uid); | auto symbol = m_session_up->getSymbolById(uid); | ||||
if (!symbol) | if (!symbol) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
auto decl_context = pdb->GetDeclContextForSymbol(*symbol); | auto decl_context = pdb->GetDeclContextForSymbol(*symbol); | ||||
if (!decl_context) | if (!decl_context) | ||||
return GetDeclContextContainingUID(uid); | return GetDeclContextContainingUID(uid); | ||||
return CompilerDeclContext(clang_ast_ctx, decl_context); | return CompilerDeclContext(clang_ast_ctx, decl_context); | ||||
} | } | ||||
lldb_private::CompilerDeclContext | lldb_private::CompilerDeclContext | ||||
SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) { | SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) { | ||||
ClangASTContext *clang_ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to get DeclContext containing UID"); | |||||
return CompilerDeclContext(); | |||||
} | |||||
ClangASTContext *clang_ast_ctx = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_ast_ctx) | if (!clang_ast_ctx) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
auto symbol = m_session_up->getSymbolById(uid); | auto symbol = m_session_up->getSymbolById(uid); | ||||
if (!symbol) | if (!symbol) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
auto decl_context = pdb->GetDeclContextContainingSymbol(*symbol); | auto decl_context = pdb->GetDeclContextContainingSymbol(*symbol); | ||||
assert(decl_context); | assert(decl_context); | ||||
return CompilerDeclContext(clang_ast_ctx, decl_context); | return CompilerDeclContext(clang_ast_ctx, decl_context); | ||||
} | } | ||||
void SymbolFilePDB::ParseDeclsForContext( | void SymbolFilePDB::ParseDeclsForContext( | ||||
lldb_private::CompilerDeclContext decl_ctx) { | lldb_private::CompilerDeclContext decl_ctx) { | ||||
ClangASTContext *clang_ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to parse decls for context"); | |||||
return; | |||||
} | |||||
ClangASTContext *clang_ast_ctx = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_ast_ctx) | if (!clang_ast_ctx) | ||||
return; | return; | ||||
PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | PDBASTParser *pdb = clang_ast_ctx->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return; | return; | ||||
pdb->ParseDeclsForDeclContext( | pdb->ParseDeclsForDeclContext( | ||||
▲ Show 20 Lines • Show All 730 Lines • ▼ Show 20 Lines | uint32_t SymbolFilePDB::FindTypes( | ||||
// There is an assumption 'name' is not a regex | // There is an assumption 'name' is not a regex | ||||
FindTypesByName(name.GetStringRef(), parent_decl_ctx, max_matches, types); | FindTypesByName(name.GetStringRef(), parent_decl_ctx, max_matches, types); | ||||
return types.GetSize(); | return types.GetSize(); | ||||
} | } | ||||
void SymbolFilePDB::DumpClangAST(Stream &s) { | void SymbolFilePDB::DumpClangAST(Stream &s) { | ||||
auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | auto type_system_or_err = | ||||
auto clang = llvm::dyn_cast_or_null<ClangASTContext>(type_system); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (!clang) | if (auto err = type_system_or_err.takeError()) { | ||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to dump ClangAST"); | |||||
return; | return; | ||||
clang->Dump(s); | } | ||||
auto *clang_type_system = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_type_system) | |||||
return; | |||||
clang_type_system->Dump(s); | |||||
} | } | ||||
void SymbolFilePDB::FindTypesByRegex( | void SymbolFilePDB::FindTypesByRegex( | ||||
const lldb_private::RegularExpression ®ex, uint32_t max_matches, | const lldb_private::RegularExpression ®ex, uint32_t max_matches, | ||||
lldb_private::TypeMap &types) { | lldb_private::TypeMap &types) { | ||||
// When searching by regex, we need to go out of our way to limit the search | // When searching by regex, we need to go out of our way to limit the search | ||||
// space as much as possible since this searches EVERYTHING in the PDB, | // space as much as possible since this searches EVERYTHING in the PDB, | ||||
// manually doing regex comparisons. PDB library isn't optimized for regex | // manually doing regex comparisons. PDB library isn't optimized for regex | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | size_t SymbolFilePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope, | ||||
for (auto type : type_collection) { | for (auto type : type_collection) { | ||||
type->GetForwardCompilerType(); | type->GetForwardCompilerType(); | ||||
type_list.Insert(type->shared_from_this()); | type_list.Insert(type->shared_from_this()); | ||||
} | } | ||||
return type_list.GetSize() - old_size; | return type_list.GetSize() - old_size; | ||||
} | } | ||||
lldb_private::TypeSystem * | llvm::Expected<lldb_private::TypeSystem &> | ||||
SymbolFilePDB::GetTypeSystemForLanguage(lldb::LanguageType language) { | SymbolFilePDB::GetTypeSystemForLanguage(lldb::LanguageType language) { | ||||
auto type_system = | auto type_system_or_err = | ||||
m_obj_file->GetModule()->GetTypeSystemForLanguage(language); | m_obj_file->GetModule()->GetTypeSystemForLanguage(language); | ||||
if (type_system) | if (type_system_or_err) { | ||||
type_system->SetSymbolFile(this); | type_system_or_err->SetSymbolFile(this); | ||||
return type_system; | } | ||||
return type_system_or_err; | |||||
} | } | ||||
PDBASTParser *SymbolFilePDB::GetPDBAstParser() { | PDBASTParser *SymbolFilePDB::GetPDBAstParser() { | ||||
auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | auto type_system_or_err = | ||||
auto clang_type_system = llvm::dyn_cast_or_null<ClangASTContext>(type_system); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to get PDB AST parser"); | |||||
return nullptr; | |||||
} | |||||
auto *clang_type_system = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_type_system) | if (!clang_type_system) | ||||
return nullptr; | return nullptr; | ||||
return clang_type_system->GetPDBParser(); | return clang_type_system->GetPDBParser(); | ||||
} | } | ||||
lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace( | lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace( | ||||
lldb_private::ConstString name, | lldb_private::ConstString name, | ||||
const lldb_private::CompilerDeclContext *parent_decl_ctx) { | const lldb_private::CompilerDeclContext *parent_decl_ctx) { | ||||
auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | auto type_system_or_err = | ||||
auto clang_type_system = llvm::dyn_cast_or_null<ClangASTContext>(type_system); | GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), "Unable to find namespace {}", | |||||
name.AsCString()); | |||||
return CompilerDeclContext(); | |||||
} | |||||
auto *clang_type_system = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_type_system) | if (!clang_type_system) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
PDBASTParser *pdb = clang_type_system->GetPDBParser(); | PDBASTParser *pdb = clang_type_system->GetPDBParser(); | ||||
if (!pdb) | if (!pdb) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
clang::DeclContext *decl_context = nullptr; | clang::DeclContext *decl_context = nullptr; | ||||
if (parent_decl_ctx) | if (parent_decl_ctx) | ||||
decl_context = static_cast<clang::DeclContext *>( | decl_context = static_cast<clang::DeclContext *>( | ||||
parent_decl_ctx->GetOpaqueDeclContext()); | parent_decl_ctx->GetOpaqueDeclContext()); | ||||
auto namespace_decl = | auto namespace_decl = | ||||
pdb->FindNamespaceDecl(decl_context, name.GetStringRef()); | pdb->FindNamespaceDecl(decl_context, name.GetStringRef()); | ||||
if (!namespace_decl) | if (!namespace_decl) | ||||
return CompilerDeclContext(); | return CompilerDeclContext(); | ||||
return CompilerDeclContext(type_system, | return CompilerDeclContext(clang_type_system, | ||||
static_cast<clang::DeclContext *>(namespace_decl)); | static_cast<clang::DeclContext *>(namespace_decl)); | ||||
} | } | ||||
lldb_private::ConstString SymbolFilePDB::GetPluginName() { | lldb_private::ConstString SymbolFilePDB::GetPluginName() { | ||||
static ConstString g_name("pdb"); | static ConstString g_name("pdb"); | ||||
return g_name; | return g_name; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | |||||
bool SymbolFilePDB::DeclContextMatchesThisSymbolFile( | bool SymbolFilePDB::DeclContextMatchesThisSymbolFile( | ||||
const lldb_private::CompilerDeclContext *decl_ctx) { | const lldb_private::CompilerDeclContext *decl_ctx) { | ||||
if (decl_ctx == nullptr || !decl_ctx->IsValid()) | if (decl_ctx == nullptr || !decl_ctx->IsValid()) | ||||
return true; | return true; | ||||
TypeSystem *decl_ctx_type_system = decl_ctx->GetTypeSystem(); | TypeSystem *decl_ctx_type_system = decl_ctx->GetTypeSystem(); | ||||
if (!decl_ctx_type_system) | if (!decl_ctx_type_system) | ||||
return false; | return false; | ||||
TypeSystem *type_system = GetTypeSystemForLanguage( | auto type_system_or_err = GetTypeSystemForLanguage( | ||||
decl_ctx_type_system->GetMinimumLanguage(nullptr)); | decl_ctx_type_system->GetMinimumLanguage(nullptr)); | ||||
if (decl_ctx_type_system == type_system) | if (auto err = type_system_or_err.takeError()) { | ||||
LLDB_LOG_ERROR( | |||||
lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), | |||||
"Unable to determine if DeclContext matches this symbol file"); | |||||
return false; | |||||
} | |||||
if (decl_ctx_type_system == &type_system_or_err.get()) | |||||
return true; // The type systems match, return true | return true; // The type systems match, return true | ||||
return false; | return false; | ||||
} | } | ||||
uint32_t SymbolFilePDB::GetCompilandId(const llvm::pdb::PDBSymbolData &data) { | uint32_t SymbolFilePDB::GetCompilandId(const llvm::pdb::PDBSymbolData &data) { | ||||
static const auto pred_upper = [](uint32_t lhs, SecContribInfo rhs) { | static const auto pred_upper = [](uint32_t lhs, SecContribInfo rhs) { | ||||
return lhs < rhs.Offset; | return lhs < rhs.Offset; | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |