diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -21,7 +21,6 @@ #include #include "clang/AST/ASTContext.h" -#include "clang/AST/ExternalASTMerger.h" #include "clang/AST/TemplateBase.h" #include "llvm/ADT/APSInt.h" #include "llvm/ADT/SmallVector.h" @@ -965,10 +964,7 @@ clang::DeclarationName GetDeclarationName(const char *name, const CompilerType &function_clang_type); - - virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() { - return m_origins; - } + protected: const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type); @@ -993,7 +989,6 @@ CompleteTagDeclCallback m_callback_tag_decl = nullptr; CompleteObjCInterfaceDeclCallback m_callback_objc_decl = nullptr; void *m_callback_baton = nullptr; - clang::ExternalASTMerger::OriginMap m_origins; uint32_t m_pointer_byte_size = 0; bool m_ast_owned = false; /// The sema associated that is currently used to build this ASTContext. @@ -1032,12 +1027,6 @@ const char *name) override; PersistentExpressionState *GetPersistentExpressionState() override; - - clang::ExternalASTMerger &GetMergerUnchecked(); - - const clang::ExternalASTMerger::OriginMap &GetOriginMap() override { - return GetMergerUnchecked().GetOrigins(); - } private: lldb::TargetWP m_target_wp; std::unique_ptr diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -203,8 +203,6 @@ void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b); - bool GetUseModernTypeLookup() const; - void SetRequireHardwareBreakpoints(bool b); bool GetRequireHardwareBreakpoints() const; diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/Makefile deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -OBJC_SOURCES := main.m -LD_EXTRAS := -lobjc -framework Foundation - -include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/TestBasicObjcModernTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/TestBasicObjcModernTypeLookup.py deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/TestBasicObjcModernTypeLookup.py +++ /dev/null @@ -1,18 +0,0 @@ -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class TestBasicObjcModernTypeLookup(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test(self): - self.build() - # Activate modern-type-lookup. - # FIXME: This has to happen before we create any target otherwise we crash... - self.runCmd("settings set target.experimental.use-modern-type-lookup true") - (target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self, - "break here", lldb.SBFileSpec("main.m")) - self.expect("expr 1", substrs=["(int) ", " = 1"]) - self.expect("expr (int)[Foo bar:22]", substrs=["(int) ", " = 44"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/main.m deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/main.m +++ /dev/null @@ -1,17 +0,0 @@ -#import - -@interface Foo : NSObject -+(int) bar: (int) string; -@end - -@implementation Foo -+(int) bar: (int) x -{ - return x + x; -} -@end - -int main() { - NSLog(@"Hello World"); - return 0; // break here -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/Makefile deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -CXX_SOURCES := main.cpp -include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/TestBasicModernTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/TestBasicModernTypeLookup.py deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/TestBasicModernTypeLookup.py +++ /dev/null @@ -1,21 +0,0 @@ -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class BasicModernTypeLookup(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - self.build() - - # Activate modern-type-lookup. - self.runCmd("settings set target.experimental.use-modern-type-lookup true") - - lldbutil.run_to_source_breakpoint(self, - "// Set break point at this line.", lldb.SBFileSpec("main.cpp")) - - # Test a few simple expressions that should still work with modern-type-lookup. - self.expect("expr 1", substrs=["(int) ", " = 1\n"]) - self.expect("expr f.x", substrs=["(int) ", " = 44\n"]) - self.expect("expr f", substrs=["(Foo) ", "x = 44"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/main.cpp deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -struct Foo { int x; }; - -int main(int argc, char **argv) { - Foo f; - f.x = 44; - return f.x; // Set break point at this line. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/Makefile deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CXX_SOURCES := main.cpp -USE_LIBCPP := 1 -include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/TestLibCxxModernTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/TestLibCxxModernTypeLookup.py deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/libcxx/TestLibCxxModernTypeLookup.py +++ /dev/null @@ -1,23 +0,0 @@ -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class LibcxxModernTypeLookup(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(["libc++"]) - def test(self): - self.build() - - # Activate modern-type-lookup. - self.runCmd("settings set target.experimental.use-modern-type-lookup true") - - lldbutil.run_to_source_breakpoint(self, - "// Set break point at this line.", lldb.SBFileSpec("main.cpp")) - - # Test a few simple expressions that should still work with modern-type-lookup. - self.expect("expr pair", substrs=["(std::", "pair -#include -#include -#include - -int main(int argc, char **argv) { - std::pair pair = std::make_pair(1, 2L); - std::string foo = "bar"; - std::map map; - map[1] = 2; - std::unordered_map umap; - umap[1] = 2; - return pair.first; // Set break point at this line. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/Makefile deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -OBJC_SOURCES := main.m -LD_EXTRAS := -lobjc -framework Foundation - -include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/TestObjModulesModernTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/TestObjModulesModernTypeLookup.py deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/TestObjModulesModernTypeLookup.py +++ /dev/null @@ -1,26 +0,0 @@ -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class TestObjcModulesModernTypeLookup(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - # gmodules causes this to crash as we seem to get a NSURL type from the debug information. - @skipIf(debug_info="gmodules") - def test(self): - self.build() - # Activate modern-type-lookup. - # FIXME: This has to happen before we create any target otherwise we crash... - self.runCmd("settings set target.experimental.use-modern-type-lookup true") - (target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self, - "break here", lldb.SBFileSpec("main.m")) - self.expect("expr @import Foundation") - self.expect( - "p *[NSURL URLWithString:@\"http://lldb.llvm.org\"]", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "NSURL", - "isa", - "_urlString"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/main.m deleted file mode 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/objc-modules/main.m +++ /dev/null @@ -1,6 +0,0 @@ -#import - -int main() { - NSLog(@"Hello World"); - return 0; // break here -} diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h @@ -15,7 +15,6 @@ #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Target.h" -#include "clang/AST/ExternalASTMerger.h" #include "clang/Basic/IdentifierTable.h" #include "llvm/ADT/SmallSet.h" @@ -340,24 +339,6 @@ /// A copy of the Decl in m_ast_context, or NULL if the copy failed. clang::Decl *CopyDecl(clang::Decl *src_decl); - /// Copies a single Type to the target of the given ExternalASTMerger. - /// - /// \param[in] src_context - /// The ASTContext containing the type. - /// - /// \param[in] merger - /// The merger to use. This isn't just *m_merger_up because it might be - /// the persistent AST context's merger. - /// - /// \param[in] type - /// The type to copy. - /// - /// \return - /// A copy of the Type in the merger's target context. - clang::QualType CopyTypeWithMerger(clang::ASTContext &src_context, - clang::ExternalASTMerger &merger, - clang::QualType type); - /// Determined the origin of a single Decl, if it can be found. /// /// \param[in] decl @@ -373,14 +354,6 @@ /// True if lookup succeeded; false otherwise. ClangASTImporter::DeclOrigin GetDeclOrigin(const clang::Decl *decl); - /// Returns m_merger_up. Only call this if the target is configured to use - /// modern lookup, - clang::ExternalASTMerger &GetMergerUnchecked(); - - /// Returns true if there is a merger. This only occurs if the target is - /// using modern lookup. - bool HasMerger() { return (bool)m_merger_up; } - protected: bool FindObjCMethodDeclsWithOrigin( unsigned int current_id, NameSearchContext &context, @@ -401,8 +374,6 @@ clang::FileManager *m_file_manager; /// The target's AST importer. lldb::ClangASTImporterSP m_ast_importer_sp; - /// The ExternalASTMerger for this parse. - std::unique_ptr m_merger_up; std::set m_active_lexical_decls; std::set m_active_lookups; }; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -52,9 +52,7 @@ ClangASTSource::ClangASTSource(const lldb::TargetSP &target) : m_import_in_progress(false), m_lookups_enabled(false), m_target(target), m_ast_context(nullptr), m_active_lexical_decls(), m_active_lookups() { - if (!target->GetUseModernTypeLookup()) { - m_ast_importer_sp = m_target->GetClangASTImporter(); - } + m_ast_importer_sp = m_target->GetClangASTImporter(); } void ClangASTSource::InstallASTContext(ClangASTContext &clang_ast_context, @@ -63,81 +61,7 @@ m_ast_context = clang_ast_context.getASTContext(); m_clang_ast_context = &clang_ast_context; m_file_manager = &file_manager; - if (m_target->GetUseModernTypeLookup()) { - // Configure the ExternalASTMerger. The merger needs to be able to import - // types from any source that we would do lookups in, which includes the - // persistent AST context as well as the modules and Objective-C runtime - // AST contexts. - - lldbassert(!m_merger_up); - clang::ExternalASTMerger::ImporterTarget target = {*m_ast_context, - file_manager}; - std::vector sources; - for (lldb::ModuleSP module_sp : m_target->GetImages().Modules()) { - auto type_system_or_err = - module_sp->GetTypeSystemForLanguage(lldb::eLanguageTypeC); - if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS), - std::move(err), "Failed to get ClangASTContext"); - } else if (auto *module_ast_ctx = llvm::cast_or_null( - &type_system_or_err.get())) { - lldbassert(module_ast_ctx->getASTContext()); - lldbassert(module_ast_ctx->getFileManager()); - sources.emplace_back(*module_ast_ctx->getASTContext(), - *module_ast_ctx->getFileManager(), - module_ast_ctx->GetOriginMap()); - } - } - - do { - lldb::ProcessSP process(m_target->GetProcessSP()); - - if (!process) - break; - - ObjCLanguageRuntime *language_runtime(ObjCLanguageRuntime::Get(*process)); - - if (!language_runtime) - break; - - if (auto *runtime_decl_vendor = llvm::dyn_cast_or_null( - language_runtime->GetDeclVendor())) { - sources.push_back(runtime_decl_vendor->GetImporterSource()); - } - } while (false); - - do { - auto *modules_decl_vendor = m_target->GetClangModulesDeclVendor(); - - if (!modules_decl_vendor) - break; - - sources.push_back(modules_decl_vendor->GetImporterSource()); - } while (false); - - if (!is_shared_context) { - // Update the scratch AST context's merger to reflect any new sources we - // might have come across since the last time an expression was parsed. - - if (auto *clang_ast_context = ClangASTContext::GetScratch(*m_target)) { - - auto scratch_ast_context = - static_cast(clang_ast_context); - - scratch_ast_context->GetMergerUnchecked().AddSources(sources); - - sources.push_back({*scratch_ast_context->getASTContext(), - *scratch_ast_context->getFileManager(), - scratch_ast_context->GetOriginMap()}); - } - } - - m_merger_up = - std::make_unique(target, sources); - } else { - m_ast_importer_sp->InstallMapCompleter(m_ast_context, *this); - } + m_ast_importer_sp->InstallMapCompleter(m_ast_context, *this); } ClangASTSource::~ClangASTSource() { @@ -293,9 +217,6 @@ ScopedLexicalDeclEraser eraser(m_active_lexical_decls, tag_decl); if (!m_ast_importer_sp) { - if (HasMerger()) { - GetMergerUnchecked().CompleteType(tag_decl); - } return; } @@ -423,18 +344,7 @@ ClangUtil::DumpDecl(interface_decl)); if (!m_ast_importer_sp) { - if (HasMerger()) { - ObjCInterfaceDecl *complete_iface_decl = - GetCompleteObjCInterface(interface_decl); - - if (complete_iface_decl && (complete_iface_decl != interface_decl)) { - m_merger_up->ForceRecordOrigin(interface_decl, {complete_iface_decl, &complete_iface_decl->getASTContext()}); - } - - GetMergerUnchecked().CompleteType(interface_decl); - } else { - lldbassert(0 && "No mechanism for completing a type!"); - } + lldbassert(0 && "No mechanism for completing a type!"); return; } @@ -510,19 +420,7 @@ llvm::function_ref predicate, llvm::SmallVectorImpl &decls) { - if (HasMerger()) { - if (auto *interface_decl = dyn_cast(decl_context)) { - ObjCInterfaceDecl *complete_iface_decl = - GetCompleteObjCInterface(interface_decl); - - if (complete_iface_decl && (complete_iface_decl != interface_decl)) { - m_merger_up->ForceRecordOrigin(interface_decl, {complete_iface_decl, &complete_iface_decl->getASTContext()}); - } - } - return GetMergerUnchecked().FindExternalLexicalDecls(decl_context, - predicate, - decls); - } else if (!m_ast_importer_sp) + if (!m_ast_importer_sp) return; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -698,25 +596,6 @@ name.GetCString(), context.m_decl_context->getDeclKindName()); } - if (HasMerger() && !isa(context.m_decl_context) - /* possibly handle NamespaceDecls here? */) { - if (auto *interface_decl = - dyn_cast(context.m_decl_context)) { - ObjCInterfaceDecl *complete_iface_decl = - GetCompleteObjCInterface(interface_decl); - - if (complete_iface_decl && (complete_iface_decl != interface_decl)) { - GetMergerUnchecked().ForceRecordOrigin( - interface_decl, - {complete_iface_decl, &complete_iface_decl->getASTContext()}); - } - } - - GetMergerUnchecked().FindExternalVisibleDeclsByName(context.m_decl_context, - context.m_decl_name); - return; // otherwise we may need to fall back - } - context.m_namespace_map = std::make_shared(); if (const NamespaceDecl *namespace_context = @@ -741,7 +620,7 @@ FindExternalVisibleDecls(context, i->first, i->second, current_id); } - } else if (isa(context.m_decl_context) && !HasMerger()) { + } else if (isa(context.m_decl_context)) { FindObjCPropertyAndIvarDecls(context); } else if (!isa(context.m_decl_context)) { // we shouldn't be getting FindExternalVisibleDecls calls for these @@ -820,7 +699,7 @@ module_sp->GetFileSpec().GetFilename().GetCString()); } } - } else if (!HasMerger()) { + } else { const ModuleList &target_images = m_target->GetImages(); std::lock_guard guard(target_images.GetMutex()); @@ -1131,21 +1010,6 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (HasMerger()) { - if (auto *interface_decl = dyn_cast(context.m_decl_context)) { - ObjCInterfaceDecl *complete_iface_decl = - GetCompleteObjCInterface(interface_decl); - - if (complete_iface_decl && (complete_iface_decl != context.m_decl_context)) { - m_merger_up->ForceRecordOrigin(interface_decl, {complete_iface_decl, &complete_iface_decl->getASTContext()}); - } - } - - GetMergerUnchecked().FindExternalVisibleDeclsByName(context.m_decl_context, - context.m_decl_name); - return; - } - static unsigned int invocation_id = 0; unsigned int current_id = invocation_id++; @@ -1950,45 +1814,10 @@ return dyn_cast(copied_decl); } -clang::QualType ClangASTSource::CopyTypeWithMerger( - clang::ASTContext &from_context, - clang::ExternalASTMerger &merger, - clang::QualType type) { - if (!merger.HasImporterForOrigin(from_context)) { - lldbassert(0 && "Couldn't find the importer for a source context!"); - return QualType(); - } - - if (llvm::Expected type_or_error = - merger.ImporterForOrigin(from_context).Import(type)) { - return *type_or_error; - } else { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); - LLDB_LOG_ERROR(log, type_or_error.takeError(), "Couldn't import type: {0}"); - return QualType(); - } -} - clang::Decl *ClangASTSource::CopyDecl(Decl *src_decl) { clang::ASTContext &from_context = src_decl->getASTContext(); if (m_ast_importer_sp) { return m_ast_importer_sp->CopyDecl(m_ast_context, &from_context, src_decl); - } else if (m_merger_up) { - if (!m_merger_up->HasImporterForOrigin(from_context)) { - lldbassert(0 && "Couldn't find the importer for a source context!"); - return nullptr; - } - - if (llvm::Expected decl_or_error = - m_merger_up->ImporterForOrigin(from_context).Import(src_decl)) { - return *decl_or_error; - } else { - Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); - LLDB_LOG_ERROR(log, decl_or_error.takeError(), - "Couldn't import decl: {0}"); - return nullptr; - } } else { lldbassert(0 && "No mechanism for copying a decl!"); return nullptr; @@ -1998,19 +1827,12 @@ ClangASTImporter::DeclOrigin ClangASTSource::GetDeclOrigin(const clang::Decl *decl) { if (m_ast_importer_sp) { return m_ast_importer_sp->GetDeclOrigin(decl); - } else if (m_merger_up) { - return ClangASTImporter::DeclOrigin(); // Implement this correctly in ExternalASTMerger } else { // this can happen early enough that no ExternalASTSource is installed. return ClangASTImporter::DeclOrigin(); } } -clang::ExternalASTMerger &ClangASTSource::GetMergerUnchecked() { - lldbassert(m_merger_up != nullptr); - return *m_merger_up; -} - CompilerType ClangASTSource::GuardedCopyType(const CompilerType &src_type) { ClangASTContext *src_ast = llvm::dyn_cast_or_null(src_type.GetTypeSystem()); @@ -2024,10 +1846,6 @@ if (m_ast_importer_sp) { copied_qual_type = ClangUtil::GetQualType( m_ast_importer_sp->CopyType(*m_clang_ast_context, src_type)); - } else if (m_merger_up) { - copied_qual_type = - CopyTypeWithMerger(*src_ast->getASTContext(), *m_merger_up, - ClangUtil::GetQualType(src_type)); } else { lldbassert(0 && "No mechanism for copying a type!"); return CompilerType(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h @@ -12,8 +12,6 @@ #include "lldb/Core/ClangForward.h" #include "lldb/Symbol/DeclVendor.h" -#include "clang/AST/ExternalASTMerger.h" - namespace lldb_private { // A clang specialized extension to DeclVendor. @@ -23,13 +21,6 @@ virtual ~ClangDeclVendor() {} - /// Interface for ExternalASTMerger. Returns an ImporterSource allowing type - /// completion. - /// - /// \return - /// An ImporterSource for this ClangDeclVendor. - virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0; - uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches, std::vector &decls) override; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -173,31 +173,6 @@ return ret; } -static clang::QualType ExportAllDeclaredTypes( - clang::ExternalASTMerger &parent_merger, clang::ExternalASTMerger &merger, - clang::ASTContext &source, clang::FileManager &source_file_manager, - const clang::ExternalASTMerger::OriginMap &source_origin_map, - clang::FileID file, clang::QualType root) { - // Mark the source as temporary to make sure all declarations from the - // AST are exported. Also add the parent_merger as the merger into the - // source AST so that the merger can track back any declarations from - // the persistent ASTs we used as sources. - clang::ExternalASTMerger::ImporterSource importer_source( - source, source_file_manager, source_origin_map, /*Temporary*/ true, - &parent_merger); - merger.AddSources(importer_source); - clang::ASTImporter &exporter = merger.ImporterForOrigin(source); - llvm::Expected ret_or_error = exporter.Import(root); - merger.RemoveSources(importer_source); - if (ret_or_error) { - return *ret_or_error; - } else { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); - LLDB_LOG_ERROR(log, ret_or_error.takeError(), "Couldn't import type: {0}"); - return clang::QualType(); - } -} - TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target, ClangASTContext &source, TypeFromParser parser_type) { @@ -207,18 +182,6 @@ if (m_ast_importer_sp) { return TypeFromUser(m_ast_importer_sp->DeportType(target, parser_type)); - } else if (m_merger_up) { - clang::FileID source_file = - source.getASTContext()->getSourceManager().getFileID( - source.getASTContext()->getTranslationUnitDecl()->getLocation()); - auto scratch_ast_context = static_cast( - ClangASTContext::GetScratch(*m_target)); - clang::QualType exported_type = ExportAllDeclaredTypes( - *m_merger_up.get(), scratch_ast_context->GetMergerUnchecked(), - *source.getASTContext(), *source.getFileManager(), - m_merger_up->GetOrigins(), source_file, - clang::QualType::getFromOpaquePtr(parser_type.GetOpaqueQualType())); - return TypeFromUser(exported_type.getAsOpaquePtr(), &target); } else { lldbassert(0 && "No mechanism for deporting a type!"); return TypeFromUser(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -84,8 +84,6 @@ void ForEachMacro(const ModuleVector &modules, std::function handler) override; - - clang::ExternalASTMerger::ImporterSource GetImporterSource() override; private: void ReportModuleExportsHelper(std::set &exports, @@ -110,7 +108,6 @@ typedef std::set ImportedModuleSet; ImportedModuleMap m_imported_modules; ImportedModuleSet m_user_imported_modules; - const clang::ExternalASTMerger::OriginMap m_origin_map; // We assume that every ASTContext has an ClangASTContext, so we also store // a custom ClangASTContext for our internal ASTContext. std::unique_ptr m_ast_context; @@ -160,7 +157,7 @@ : m_diagnostics_engine(std::move(diagnostics_engine)), m_compiler_invocation(std::move(compiler_invocation)), m_compiler_instance(std::move(compiler_instance)), - m_parser(std::move(parser)), m_origin_map() { + m_parser(std::move(parser)) { // Initialize our ClangASTContext. m_ast_context.reset(new ClangASTContext(m_compiler_instance->getASTContext())); @@ -569,13 +566,6 @@ is_inclusion_directive); } -clang::ExternalASTMerger::ImporterSource -ClangModulesDeclVendorImpl::GetImporterSource() { - return clang::ExternalASTMerger::ImporterSource( - m_compiler_instance->getASTContext(), - m_compiler_instance->getFileManager(), m_origin_map); -} - static const char *ModuleImportBufferName = "LLDBModulesMemoryBuffer"; lldb_private::ClangModulesDeclVendor * diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h @@ -30,8 +30,6 @@ uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches, std::vector &decls) override; - clang::ExternalASTMerger::ImporterSource GetImporterSource() override; - friend class AppleObjCExternalASTSource; private: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -639,10 +639,3 @@ return ret; } - -clang::ExternalASTMerger::ImporterSource -AppleObjCDeclVendor::GetImporterSource() { - return clang::ExternalASTMerger::ImporterSource(*m_ast_ctx.getASTContext(), - *m_ast_ctx.getFileManager(), - m_ast_ctx.GetOriginMap()); -} diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -9517,9 +9517,3 @@ ClangASTContextForExpressions::GetPersistentExpressionState() { return m_persistent_variables.get(); } - -clang::ExternalASTMerger & -ClangASTContextForExpressions::GetMergerUnchecked() { - lldbassert(m_scratch_ast_source_up != nullptr); - return m_scratch_ast_source_up->GetMergerUnchecked(); -} diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3545,18 +3545,6 @@ true); } -bool TargetProperties::GetUseModernTypeLookup() const { - const Property *exp_property = m_collection_sp->GetPropertyAtIndex( - nullptr, false, ePropertyExperimental); - OptionValueProperties *exp_values = - exp_property->GetValue()->GetAsProperties(); - if (exp_values) - return exp_values->GetPropertyAtIndexAsBoolean( - nullptr, ePropertyUseModernTypeLookup, true); - else - return true; -} - ArchSpec TargetProperties::GetDefaultArchitecture() const { OptionValueArch *value = m_collection_sp->GetPropertyAtIndexAsOptionValueArch( nullptr, ePropertyDefaultArch); diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -4,9 +4,6 @@ def InjectLocalVars : Property<"inject-local-vars", "Boolean">, Global, DefaultTrue, Desc<"If true, inject local variables explicitly into the expression text. This will fix symbol resolution when there are name collisions between ivars and local variables. But it can make expressions run much more slowly.">; - def UseModernTypeLookup : Property<"use-modern-type-lookup", "Boolean">, - Global, DefaultFalse, - Desc<"If true, use Clang's modern type lookup infrastructure.">; } let Definition = "target" in {