Index: source/Plugins/SymbolFile/PDB/PDBASTParser.h =================================================================== --- source/Plugins/SymbolFile/PDB/PDBASTParser.h +++ source/Plugins/SymbolFile/PDB/PDBASTParser.h @@ -52,7 +52,7 @@ virtual lldb_private::CompilerDecl GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) = 0; - virtual clang::DeclContext * + virtual lldb_private::CompilerDeclContext GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol) = 0; virtual clang::DeclContext * GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol) = 0; Index: source/Plugins/SymbolFile/PDB/PDBASTParserClang.h =================================================================== --- source/Plugins/SymbolFile/PDB/PDBASTParserClang.h +++ source/Plugins/SymbolFile/PDB/PDBASTParserClang.h @@ -52,7 +52,7 @@ lldb_private::CompilerDecl GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) override; - clang::DeclContext * + lldb_private::CompilerDeclContext GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol) override; clang::DeclContext * GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol) override; Index: source/Plugins/SymbolFile/PDB/PDBASTParserClang.cpp =================================================================== --- source/Plugins/SymbolFile/PDB/PDBASTParserClang.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParserClang.cpp @@ -964,7 +964,7 @@ } } -clang::DeclContext * +lldb_private::CompilerDeclContext PDBASTParserClang::GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol) { if (symbol.getSymTag() == PDB_SymType::Function) { clang::Decl *decl = @@ -976,16 +976,16 @@ if (result) m_decl_context_to_uid[result] = symbol.getSymIndexId(); - return result; + return CompilerDeclContext(&m_ast, result); } auto symbol_file = static_cast(m_ast.GetSymbolFile()); if (!symbol_file) - return nullptr; + return CompilerDeclContext(); auto type = symbol_file->ResolveTypeUID(symbol.getSymIndexId()); if (!type) - return nullptr; + return CompilerDeclContext(); clang::DeclContext *result = m_ast.GetDeclContextForType(type->GetForwardCompilerType()); @@ -993,7 +993,7 @@ if (result) m_decl_context_to_uid[result] = symbol.getSymIndexId(); - return result; + return CompilerDeclContext(&m_ast, result); } clang::DeclContext *PDBASTParserClang::GetDeclContextContainingSymbol( @@ -1001,7 +1001,8 @@ auto parent = GetClassOrFunctionParent(symbol); while (parent) { if (auto parent_context = GetDeclContextForSymbol(*parent)) - return parent_context; + return static_cast( + parent_context.GetOpaqueDeclContext()); parent = GetClassOrFunctionParent(*parent); } @@ -1036,7 +1037,8 @@ while (IPDBEnumChildren::ChildTypePtr child = children_enum->getNext()) { if (clang::DeclContext *child_context = - GetDeclContextForSymbol(*child)) { + static_cast( + GetDeclContextForSymbol(*child).GetOpaqueDeclContext())) { // Note that `GetDeclContextForSymbol' retrieves // a declaration context for functions and types only, // so if we are here then `child_context' is guaranteed Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp =================================================================== --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -629,7 +629,7 @@ if (!decl_context) return GetDeclContextContainingUID(uid); - return CompilerDeclContext(clang_ast_ctx, decl_context); + return decl_context; } lldb_private::CompilerDeclContext