diff --git a/lldb/include/lldb/Symbol/ClangASTImporter.h b/lldb/include/lldb/Symbol/ClangASTImporter.h --- a/lldb/include/lldb/Symbol/ClangASTImporter.h +++ b/lldb/include/lldb/Symbol/ClangASTImporter.h @@ -48,11 +48,11 @@ : m_file_manager(clang::FileSystemOptions(), FileSystem::Instance().GetVirtualFileSystem()) {} - CompilerType CopyType(ClangASTContext &dst, const CompilerType &src_type); + CompilerType CopyType(TypeSystemClang &dst, const CompilerType &src_type); clang::Decl *CopyDecl(clang::ASTContext *dst_ctx, clang::Decl *decl); - CompilerType DeportType(ClangASTContext &dst, const CompilerType &src_type); + CompilerType DeportType(TypeSystemClang &dst, const CompilerType &src_type); clang::Decl *DeportDecl(clang::ASTContext *dst_ctx, clang::Decl *decl); diff --git a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h --- a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h +++ b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h @@ -9,16 +9,16 @@ #ifndef liblldb_ClangExternalASTSourceCallbacks_h_ #define liblldb_ClangExternalASTSourceCallbacks_h_ -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "clang/AST/ExternalASTSource.h" namespace lldb_private { -class ClangASTContext; +class TypeSystemClang; class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource { public: - ClangExternalASTSourceCallbacks(ClangASTContext &ast) : m_ast(ast) {} + ClangExternalASTSourceCallbacks(TypeSystemClang &ast) : m_ast(ast) {} void FindExternalLexicalDecls( const clang::DeclContext *DC, @@ -38,7 +38,7 @@ &VirtualBaseOffsets) override; private: - ClangASTContext &m_ast; + TypeSystemClang &m_ast; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h b/lldb/include/lldb/Symbol/CompilerDeclContext.h --- a/lldb/include/lldb/Symbol/CompilerDeclContext.h +++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h @@ -38,7 +38,7 @@ /// This constructor should only be called from the respective TypeSystem /// implementation. /// - /// \see lldb_private::ClangASTContext::CreateDeclContext(clang::DeclContext*) + /// \see lldb_private::TypeSystemClang::CreateDeclContext(clang::DeclContext*) CompilerDeclContext(TypeSystem *type_system, void *decl_ctx) : m_type_system(type_system), m_opaque_decl_ctx(decl_ctx) {} diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -37,7 +37,7 @@ /// This constructor should only be called from the respective TypeSystem /// implementation. /// - /// \see lldb_private::ClangASTContext::GetType(clang::QualType) + /// \see lldb_private::TypeSystemClang::GetType(clang::QualType) CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type) : m_type(type), m_type_system(type_system) {} diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -380,7 +380,7 @@ lldb::offset_t data_offset, size_t data_byte_size) = 0; - // TODO: Determine if these methods should move to ClangASTContext. + // TODO: Determine if these methods should move to TypeSystemClang. virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) = 0; diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/TypeSystemClang.h rename from lldb/include/lldb/Symbol/ClangASTContext.h rename to lldb/include/lldb/Symbol/TypeSystemClang.h --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/TypeSystemClang.h @@ -1,4 +1,4 @@ -//===-- ClangASTContext.h ---------------------------------------*- C++ -*-===// +//===-- TypeSystemClang.h ---------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_ClangASTContext_h_ -#define liblldb_ClangASTContext_h_ +#ifndef liblldb_TypeSystemClang_h_ +#define liblldb_TypeSystemClang_h_ #include @@ -42,7 +42,7 @@ class Declaration; -class ClangASTContext : public TypeSystem { +class TypeSystemClang : public TypeSystem { // LLVM RTTI support static char ID; @@ -55,24 +55,24 @@ bool isA(const void *ClassID) const override { return ClassID == &ID; } static bool classof(const TypeSystem *ts) { return ts->isA(&ID); } - /// Constructs a ClangASTContext with an ASTContext using the given triple. + /// Constructs a TypeSystemClang with an ASTContext using the given triple. /// - /// \param name The name for the ClangASTContext (for logging purposes) + /// \param name The name for the TypeSystemClang (for logging purposes) /// \param triple The llvm::Triple used for the ASTContext. The triple defines /// certain characteristics of the ASTContext and its types /// (e.g., whether certain primitive types exist or what their /// signedness is). - explicit ClangASTContext(llvm::StringRef name, llvm::Triple triple); + explicit TypeSystemClang(llvm::StringRef name, llvm::Triple triple); - /// Constructs a ClangASTContext that uses an existing ASTContext internally. + /// Constructs a TypeSystemClang that uses an existing ASTContext internally. /// Useful when having an existing ASTContext created by Clang. /// - /// \param name The name for the ClangASTContext (for logging purposes) + /// \param name The name for the TypeSystemClang (for logging purposes) /// \param existing_ctxt An existing ASTContext. - explicit ClangASTContext(llvm::StringRef name, + explicit TypeSystemClang(llvm::StringRef name, clang::ASTContext &existing_ctxt); - ~ClangASTContext() override; + ~TypeSystemClang() override; void Finalize() override; @@ -93,21 +93,21 @@ static void Terminate(); - static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx); + static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx); - static ClangASTContext *GetScratch(Target &target, + static TypeSystemClang *GetScratch(Target &target, bool create_on_demand = true) { auto type_system_or_err = target.GetScratchTypeSystemForLanguage( lldb::eLanguageTypeC, create_on_demand); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), - std::move(err), "Couldn't get scratch ClangASTContext"); + std::move(err), "Couldn't get scratch TypeSystemClang"); return nullptr; } - return llvm::dyn_cast(&type_system_or_err.get()); + return llvm::dyn_cast(&type_system_or_err.get()); } - /// Returns the display name of this ClangASTContext that indicates what + /// Returns the display name of this TypeSystemClang that indicates what /// purpose it serves in LLDB. Used for example in logs. llvm::StringRef getDisplayName() const { return m_display_name; } @@ -128,7 +128,7 @@ llvm::IntrusiveRefCntPtr &ast_source_up); bool GetCompleteDecl(clang::Decl *decl) { - return ClangASTContext::GetCompleteDecl(&getASTContext(), decl); + return TypeSystemClang::GetCompleteDecl(&getASTContext(), decl); } static void DumpDeclHiearchy(clang::Decl *decl); @@ -176,16 +176,16 @@ bool ignore_qualifiers = false); /// Creates a CompilerType form the given QualType with the current - /// ClangASTContext instance as the CompilerType's typesystem. + /// TypeSystemClang instance as the CompilerType's typesystem. /// \param qt The QualType for a type that belongs to the ASTContext of this - /// ClangASTContext. + /// TypeSystemClang. /// \return The CompilerType representing the given QualType. If the /// QualType's type pointer is a nullptr then the function returns an /// invalid CompilerType. CompilerType GetType(clang::QualType qt) { if (qt.getTypePtrOrNull() == nullptr) return CompilerType(); - // Check that the type actually belongs to this ClangASTContext. + // Check that the type actually belongs to this TypeSystemClang. assert(qt->getAsTagDecl() == nullptr || &qt->getAsTagDecl()->getASTContext() == &getASTContext()); return CompilerType(this, qt.getAsOpaquePtr()); @@ -326,7 +326,7 @@ int *assigned_accessibilities, size_t num_assigned_accessibilities); - // Returns a mask containing bits from the ClangASTContext::eTypeXXX + // Returns a mask containing bits from the TypeSystemClang::eTypeXXX // enumerations // Namespace Declarations @@ -392,7 +392,7 @@ DWARFASTParser *GetDWARFParser() override; PDBASTParser *GetPDBParser() override; - // ClangASTContext callbacks for external source lookups. + // TypeSystemClang callbacks for external source lookups. void CompleteTagDecl(clang::TagDecl *); void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *); @@ -424,9 +424,9 @@ // CompilerDeclContext override functions /// Creates a CompilerDeclContext from the given DeclContext - /// with the current ClangASTContext instance as its typesystem. + /// with the current TypeSystemClang instance as its typesystem. /// The DeclContext has to come from the ASTContext of this - /// ClangASTContext. + /// TypeSystemClang. CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx); std::vector @@ -466,7 +466,7 @@ const clang::Decl *object); static clang::ASTContext * - DeclContextGetClangASTContext(const CompilerDeclContext &dc); + DeclContextGetTypeSystemClang(const CompilerDeclContext &dc); // Tests @@ -898,7 +898,7 @@ 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); + const TypeSystemClang::TemplateParameterInfos &template_param_infos); clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx); @@ -936,7 +936,7 @@ const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type); - // Classes that inherit from ClangASTContext can see and modify these + // Classes that inherit from TypeSystemClang can see and modify these std::string m_target_triple; std::unique_ptr m_ast_up; std::unique_ptr m_language_options_up; @@ -954,7 +954,7 @@ std::unique_ptr m_mangle_ctx_up; uint32_t m_pointer_byte_size = 0; bool m_ast_owned = false; - /// A string describing what this ClangASTContext represents (e.g., + /// A string describing what this TypeSystemClang represents (e.g., /// AST for debug information, an expression, some other utility ClangAST). /// Useful for logging and debugging. std::string m_display_name; @@ -972,19 +972,19 @@ /// ASTContext wasn't created by parsing source code. clang::Sema *m_sema = nullptr; - // For ClangASTContext only - ClangASTContext(const ClangASTContext &); - const ClangASTContext &operator=(const ClangASTContext &); + // For TypeSystemClang only + TypeSystemClang(const TypeSystemClang &); + const TypeSystemClang &operator=(const TypeSystemClang &); /// Creates the internal ASTContext. void CreateASTContext(); void SetTargetTriple(llvm::StringRef target_triple); }; -class ClangASTContextForExpressions : public ClangASTContext { +class TypeSystemClangForExpressions : public TypeSystemClang { public: - ClangASTContextForExpressions(Target &target, llvm::Triple triple); + TypeSystemClangForExpressions(Target &target, llvm::Triple triple); - ~ClangASTContextForExpressions() override = default; + ~TypeSystemClangForExpressions() override = default; void Finalize() override; @@ -1014,4 +1014,4 @@ } // namespace lldb_private -#endif // liblldb_ClangASTContext_h_ +#endif // liblldb_TypeSystemClang_h_ diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -45,7 +45,7 @@ class Broadcaster; class BroadcasterManager; class CallFrameInfo; -class ClangASTContext; +class TypeSystemClang; class ClangASTImporter; class ClangASTMetadata; class ClangASTSource; @@ -304,7 +304,7 @@ typedef std::shared_ptr BroadcasterSP; typedef std::shared_ptr BroadcasterManagerSP; typedef std::weak_ptr BroadcasterManagerWP; -typedef std::unique_ptr ClangASTContextUP; +typedef std::unique_ptr TypeSystemClangUP; typedef std::shared_ptr ClangASTImporterSP; typedef std::unique_ptr ClangModulesDeclVendorUP; diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py b/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py --- a/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py @@ -40,7 +40,7 @@ self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[' = ALL$']) # Test that an enum that doesn't match the heuristic we use in - # ClangASTContext::DumpEnumValue, gets printed as a raw integer. + # TypeSystemClang::DumpEnumValue, gets printed as a raw integer. self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[' = 7$']) # Test the behavior in case have a variable of a type considered diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -22,7 +22,7 @@ #include "lldb/Host/Host.h" #include "lldb/Initialization/SystemInitializerCommon.h" #include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Utility/Timer.h" #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h" @@ -205,7 +205,7 @@ llvm::InitializeAllTargetMCs(); llvm::InitializeAllDisassemblers(); - ClangASTContext::Initialize(); + TypeSystemClang::Initialize(); #define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Initialize) #include "llvm/Config/Targets.def" @@ -298,7 +298,7 @@ // Terminate and unload and loaded system or user LLDB plug-ins PluginManager::Terminate(); - ClangASTContext::Terminate(); + TypeSystemClang::Terminate(); ArchitectureArm::Terminate(); ArchitectureMips::Terminate(); diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -25,7 +25,7 @@ #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Host/Config.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Declaration.h" @@ -2019,7 +2019,7 @@ GetParent() && GetParent()->GetBaseClassPath(s); CompilerType compiler_type = GetCompilerType(); llvm::Optional cxx_class_name = - ClangASTContext::GetCXXClassName(compiler_type); + TypeSystemClang::GetCXXClassName(compiler_type); if (cxx_class_name) { if (parent_had_base_class) s.PutCString("::"); diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp --- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp @@ -19,7 +19,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Core/ValueObjectMemory.h" #include "lldb/Core/ValueObjectRegister.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" @@ -806,10 +806,10 @@ // case 3: get from GPRs // first, check if this is a packed struct or not - ClangASTContext *ast = - llvm::dyn_cast(m_type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast(m_type.GetTypeSystem()); if (ast) { - clang::RecordDecl *record_decl = ClangASTContext::GetAsRecordDecl(m_type); + clang::RecordDecl *record_decl = TypeSystemClang::GetAsRecordDecl(m_type); if (record_decl) { auto attrs = record_decl->attrs(); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -16,7 +16,7 @@ #include "lldb/Core/Section.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Host/FileSystem.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ABI.h" @@ -1072,8 +1072,8 @@ } StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(0); if (frame_sp) { - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(target); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(target); if (!clang_ast_context) return LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/ABI.h" @@ -222,8 +222,8 @@ // Build up the value array to store the three arguments given above, then // get the values from the ABI: - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(process->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ABI.h" @@ -341,8 +341,8 @@ // Build up the value array to store the three arguments given above, then // get the values from the ABI: - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(process->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -10,7 +10,7 @@ #include "ClangPersistentVariables.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTImporter.h" #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" @@ -453,7 +453,7 @@ return; auto *persistent_vars = llvm::cast(state); - ClangASTContext *scratch_ctx = ClangASTContext::GetScratch(m_target); + TypeSystemClang *scratch_ctx = TypeSystemClang::GetScratch(m_target); for (clang::NamedDecl *decl : m_decls) { StringRef name = decl->getName(); 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 @@ -60,7 +60,7 @@ } void MaterializeVisibleDecls(const clang::DeclContext *DC) { return; } - void InstallASTContext(ClangASTContext &ast_context); + void InstallASTContext(TypeSystemClang &ast_context); // // APIs for ExternalASTSource @@ -307,7 +307,7 @@ /// is the containing object. void FindObjCPropertyAndIvarDecls(NameSearchContext &context); - /// A wrapper for ClangASTContext::CopyType that sets a flag that + /// A wrapper for TypeSystemClang::CopyType that sets a flag that /// indicates that we should not respond to queries during import. /// /// \param[in] src_type @@ -370,8 +370,8 @@ const lldb::TargetSP m_target; /// The AST context requests are coming in for. clang::ASTContext *m_ast_context; - /// The ClangASTContext for m_ast_context. - ClangASTContext *m_clang_ast_context; + /// The TypeSystemClang for m_ast_context. + TypeSystemClang *m_clang_ast_context; /// The file manager paired with the AST context. clang::FileManager *m_file_manager; /// The target's AST importer. 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 @@ -13,7 +13,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/Symbol/Function.h" @@ -56,7 +56,7 @@ m_ast_importer_sp = importer; } -void ClangASTSource::InstallASTContext(ClangASTContext &clang_ast_context) { +void ClangASTSource::InstallASTContext(TypeSystemClang &clang_ast_context) { m_ast_context = &clang_ast_context.getASTContext(); m_clang_ast_context = &clang_ast_context; m_file_manager = &m_ast_context->getSourceManager().getFileManager(); @@ -73,9 +73,9 @@ return; // We are in the process of destruction, don't create clang ast context on // demand by passing false to - // Target::GetScratchClangASTContext(create_on_demand). - ClangASTContext *scratch_clang_ast_context = - ClangASTContext::GetScratch(*m_target, false); + // Target::GetScratchTypeSystemClang(create_on_demand). + TypeSystemClang *scratch_clang_ast_context = + TypeSystemClang::GetScratch(*m_target, false); if (!scratch_clang_ast_context) return; @@ -319,7 +319,7 @@ // We have found a type by basename and we need to make sure the decl // contexts are the same before we can try to complete this type with // another - if (!ClangASTContext::DeclsAreEquivalent(tag_decl, candidate_tag_decl)) + if (!TypeSystemClang::DeclsAreEquivalent(tag_decl, candidate_tag_decl)) continue; if (m_ast_importer_sp->CompleteTagDeclWithOrigin(tag_decl, @@ -950,7 +950,7 @@ llvm::SmallVector methods; - ClangASTContext::GetCompleteDecl(original_ctx, original_interface_decl); + TypeSystemClang::GetCompleteDecl(original_ctx, original_interface_decl); if (ObjCMethodDecl *instance_method_decl = original_interface_decl->lookupInstanceMethod(original_selector)) { @@ -1146,7 +1146,7 @@ continue; ObjCMethodDecl *method_decl = - ClangASTContext::DeclContextGetAsObjCMethodDecl(function_decl_ctx); + TypeSystemClang::DeclContextGetAsObjCMethodDecl(function_decl_ctx); if (!method_decl) continue; @@ -1574,7 +1574,7 @@ BaseOffsetMap origin_base_offsets; BaseOffsetMap origin_virtual_base_offsets; - ClangASTContext::GetCompleteDecl( + TypeSystemClang::GetCompleteDecl( &origin_record->getASTContext(), const_cast(origin_record.decl)); @@ -1763,11 +1763,11 @@ const CompilerDeclContext &namespace_decl = namespace_decls->begin()->second; clang::ASTContext *src_ast = - ClangASTContext::DeclContextGetClangASTContext(namespace_decl); + TypeSystemClang::DeclContextGetTypeSystemClang(namespace_decl); if (!src_ast) return nullptr; clang::NamespaceDecl *src_namespace_decl = - ClangASTContext::DeclContextGetAsNamespaceDecl(namespace_decl); + TypeSystemClang::DeclContextGetAsNamespaceDecl(namespace_decl); if (!src_namespace_decl) return nullptr; @@ -1809,8 +1809,8 @@ } CompilerType ClangASTSource::GuardedCopyType(const CompilerType &src_type) { - ClangASTContext *src_ast = - llvm::dyn_cast_or_null(src_type.GetTypeSystem()); + TypeSystemClang *src_ast = + llvm::dyn_cast_or_null(src_type.GetTypeSystem()); if (src_ast == nullptr) return CompilerType(); @@ -1843,8 +1843,8 @@ if (!type.IsValid()) return nullptr; - ClangASTContext *lldb_ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *lldb_ast = + llvm::dyn_cast(type.GetTypeSystem()); if (!lldb_ast) return nullptr; @@ -1870,8 +1870,8 @@ if (m_function_types.count(type)) return nullptr; - ClangASTContext *lldb_ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *lldb_ast = + llvm::dyn_cast(type.GetTypeSystem()); if (!lldb_ast) return nullptr; @@ -1941,8 +1941,8 @@ // will crash in clang. clang::OverloadedOperatorKind op_kind = clang::NUM_OVERLOADED_OPERATORS; if (func_proto_type && - ClangASTContext::IsOperator(decl_name.getAsString().c_str(), op_kind)) { - if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( + TypeSystemClang::IsOperator(decl_name.getAsString().c_str(), op_kind)) { + if (!TypeSystemClang::CheckOverloadedOperatorKindParameterCount( false, op_kind, func_proto_type->getNumParams())) return nullptr; } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp @@ -8,7 +8,7 @@ #include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Utility/ConstString.h" using namespace lldb_private; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h @@ -641,18 +641,18 @@ /// export all components of the type also. /// /// \param[in] target - /// The ClangASTContext to move to. + /// The TypeSystemClang to move to. /// \param[in] source - /// The ClangASTContext to move from. This is assumed to be going away. + /// The TypeSystemClang to move from. This is assumed to be going away. /// \param[in] parser_type /// The type as it appears in the source context. /// /// \return /// Returns the moved type, or an empty type if there was a problem. - TypeFromUser DeportType(ClangASTContext &target, ClangASTContext &source, + TypeFromUser DeportType(TypeSystemClang &target, TypeSystemClang &source, TypeFromParser parser_type); - ClangASTContext *GetClangASTContext(); + TypeSystemClang *GetTypeSystemClang(); }; } // namespace lldb_private 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 @@ -18,7 +18,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Expression/Materializer.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/CompilerDecl.h" @@ -109,7 +109,7 @@ m_parser_vars->m_persistent_vars = llvm::cast( target->GetPersistentExpressionStateForLanguage(eLanguageTypeC)); - if (!ClangASTContext::GetScratch(*target)) + if (!TypeSystemClang::GetScratch(*target)) return false; } @@ -174,10 +174,10 @@ return ret; } -TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target, - ClangASTContext &source, +TypeFromUser ClangExpressionDeclMap::DeportType(TypeSystemClang &target, + TypeSystemClang &source, TypeFromParser parser_type) { - assert(&target == ClangASTContext::GetScratch(*m_target)); + assert(&target == TypeSystemClang::GetScratch(*m_target)); assert((TypeSystem *)&source == parser_type.GetTypeSystem()); assert(&source.getASTContext() == m_ast_context); @@ -196,8 +196,8 @@ bool is_lvalue) { assert(m_parser_vars.get()); - ClangASTContext *ast = - llvm::dyn_cast_or_null(parser_type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast_or_null(parser_type.GetTypeSystem()); if (ast == nullptr) return false; @@ -209,7 +209,7 @@ if (target == nullptr) return false; - auto *clang_ast_context = ClangASTContext::GetScratch(*target); + auto *clang_ast_context = TypeSystemClang::GetScratch(*target); if (!clang_ast_context) return false; @@ -248,7 +248,7 @@ if (target == nullptr) return false; - ClangASTContext *context = ClangASTContext::GetScratch(*target); + TypeSystemClang *context = TypeSystemClang::GetScratch(*target); if (!context) return false; @@ -613,7 +613,7 @@ return vars.GetVariableAtIndex(0); } -ClangASTContext *ClangExpressionDeclMap::GetClangASTContext() { +TypeSystemClang *ClangExpressionDeclMap::GetTypeSystemClang() { StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); if (frame == nullptr) return nullptr; @@ -627,7 +627,7 @@ if (!frame_decl_context) return nullptr; - return llvm::dyn_cast_or_null( + return llvm::dyn_cast_or_null( frame_decl_context.GetTypeSystem()); } @@ -734,7 +734,7 @@ if (!target) return nullptr; - ClangASTContext::GetScratch(*target); + TypeSystemClang::GetScratch(*target); if (!m_parser_vars->m_persistent_vars) return nullptr; @@ -814,7 +814,7 @@ return; clang::CXXMethodDecl *method_decl = - ClangASTContext::DeclContextGetAsCXXMethodDecl(function_decl_ctx); + TypeSystemClang::DeclContextGetAsCXXMethodDecl(function_decl_ctx); if (method_decl) { clang::CXXRecordDecl *class_decl = method_decl->getParent(); @@ -915,7 +915,7 @@ return; clang::ObjCMethodDecl *method_decl = - ClangASTContext::DeclContextGetAsObjCMethodDecl(function_decl_ctx); + TypeSystemClang::DeclContextGetAsObjCMethodDecl(function_decl_ctx); if (method_decl) { ObjCInterfaceDecl *self_interface = method_decl->getClassInterface(); @@ -984,10 +984,10 @@ CompilerType self_clang_type = self_type->GetFullCompilerType(); - if (ClangASTContext::IsObjCClassType(self_clang_type)) { + if (TypeSystemClang::IsObjCClassType(self_clang_type)) { return; } - if (!ClangASTContext::IsObjCObjectPointerType(self_clang_type)) + if (!TypeSystemClang::IsObjCObjectPointerType(self_clang_type)) return; self_clang_type = self_clang_type.GetPointeeType(); @@ -1015,7 +1015,7 @@ if (!frame_decl_context) return; - ClangASTContext *frame_ast = llvm::dyn_cast_or_null( + TypeSystemClang *frame_ast = llvm::dyn_cast_or_null( frame_decl_context.GetTypeSystem()); if (!frame_ast) return; @@ -1148,7 +1148,7 @@ decl_infos.reserve(num_indices); clang::DeclContext *frame_decl_ctx = (clang::DeclContext *)frame_decl_context.GetOpaqueDeclContext(); - ClangASTContext *ast = llvm::dyn_cast_or_null( + TypeSystemClang *ast = llvm::dyn_cast_or_null( frame_decl_context.GetTypeSystem()); for (uint32_t index = 0; index < num_indices; ++index) { @@ -1499,7 +1499,7 @@ return false; } - ClangASTContext *clang_ast = llvm::dyn_cast_or_null( + TypeSystemClang *clang_ast = llvm::dyn_cast_or_null( var_type->GetForwardCompilerType().GetTypeSystem()); if (!clang_ast) { @@ -1671,7 +1671,7 @@ if (target == nullptr) return; - ClangASTContext *scratch_ast_context = ClangASTContext::GetScratch(*target); + TypeSystemClang *scratch_ast_context = TypeSystemClang::GetScratch(*target); if (!scratch_ast_context) return; @@ -1780,7 +1780,7 @@ if (!extern_c) { TypeSystem *type_system = function->GetDeclContext().GetTypeSystem(); - if (llvm::isa(type_system)) { + if (llvm::isa(type_system)) { clang::DeclContext *src_decl_context = (clang::DeclContext *)function->GetDeclContext() .GetOpaqueDeclContext(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h @@ -171,7 +171,7 @@ class LLDBPreprocessorCallbacks; LLDBPreprocessorCallbacks *m_pp_callbacks; ///< Called when the preprocessor ///encounters module imports - std::unique_ptr m_ast_context; + std::unique_ptr m_ast_context; std::vector m_include_directories; /// File name used for the user expression. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -75,7 +75,7 @@ #include "lldb/Expression/IRInterpreter.h" #include "lldb/Host/File.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Language.h" @@ -606,7 +606,7 @@ m_compiler->createASTContext(); clang::ASTContext &ast_context = m_compiler->getASTContext(); - m_ast_context.reset(new ClangASTContext( + m_ast_context.reset(new TypeSystemClang( "Expression ASTContext for '" + m_filename + "'", ast_context)); std::string module_name("$__lldb_module"); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp @@ -26,7 +26,7 @@ #include "lldb/Core/ValueObjectList.h" #include "lldb/Expression/IRExecutionUnit.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Type.h" #include "lldb/Target/ExecutionContext.h" 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 @@ -27,7 +27,7 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/SourceModule.h" #include "lldb/Target/Target.h" @@ -108,9 +108,9 @@ typedef std::set ImportedModuleSet; ImportedModuleMap m_imported_modules; ImportedModuleSet m_user_imported_modules; - // 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; + // We assume that every ASTContext has an TypeSystemClang, so we also store + // a custom TypeSystemClang for our internal ASTContext. + std::unique_ptr m_ast_context; }; } // anonymous namespace @@ -159,9 +159,9 @@ m_compiler_instance(std::move(compiler_instance)), m_parser(std::move(parser)) { - // Initialize our ClangASTContext. + // Initialize our TypeSystemClang. m_ast_context.reset( - new ClangASTContext("ClangModulesDeclVendor ASTContext", + new TypeSystemClang("ClangModulesDeclVendor ASTContext", m_compiler_instance->getASTContext())); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h @@ -63,7 +63,7 @@ GetCompilerTypeFromPersistentDecl(ConstString type_name) override; void RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl, - ClangASTContext *ctx); + TypeSystemClang *ctx); clang::NamedDecl *GetPersistentDecl(ConstString name); @@ -84,8 +84,8 @@ struct PersistentDecl { /// The persistent decl. clang::NamedDecl *m_decl = nullptr; - /// The ClangASTContext for the ASTContext of m_decl. - ClangASTContext *m_context = nullptr; + /// The TypeSystemClang for the ASTContext of m_decl. + TypeSystemClang *m_context = nullptr; }; typedef llvm::DenseMap PersistentDeclMap; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp @@ -9,7 +9,7 @@ #include "ClangPersistentVariables.h" #include "lldb/Core/Value.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" @@ -82,7 +82,7 @@ void ClangPersistentVariables::RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl, - ClangASTContext *ctx) { + TypeSystemClang *ctx) { PersistentDecl p = {decl, ctx}; m_persistent_decls.insert(std::make_pair(name.GetCString(), p)); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -37,7 +37,7 @@ #include "lldb/Expression/Materializer.h" #include "lldb/Host/HostInfo.h" #include "lldb/Symbol/Block.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTMetadata.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" @@ -154,7 +154,7 @@ } m_needs_object_ptr = true; } else if (clang::CXXMethodDecl *method_decl = - ClangASTContext::DeclContextGetAsCXXMethodDecl(decl_context)) { + TypeSystemClang::DeclContextGetAsCXXMethodDecl(decl_context)) { if (m_allow_cxx && method_decl->isInstance()) { if (m_enforce_valid_object) { lldb::VariableListSP variable_list_sp( @@ -183,7 +183,7 @@ m_needs_object_ptr = true; } } else if (clang::ObjCMethodDecl *method_decl = - ClangASTContext::DeclContextGetAsObjCMethodDecl( + TypeSystemClang::DeclContextGetAsObjCMethodDecl( decl_context)) { if (m_allow_objc) { if (m_enforce_valid_object) { @@ -216,7 +216,7 @@ m_in_static_method = true; } } else if (clang::FunctionDecl *function_decl = - ClangASTContext::DeclContextGetAsFunctionDecl(decl_context)) { + TypeSystemClang::DeclContextGetAsFunctionDecl(decl_context)) { // We might also have a function that said in the debug information that it // captured an object pointer. The best way to deal with getting to the // ivars at present is by pretending that this is a method of a class in @@ -224,7 +224,7 @@ // that here. ClangASTMetadata *metadata = - ClangASTContext::DeclContextGetMetaData(decl_context, function_decl); + TypeSystemClang::DeclContextGetMetaData(decl_context, function_decl); if (metadata && metadata->HasObjectPtr()) { lldb::LanguageType language = metadata->GetObjectPtrLanguage(); if (language == lldb::eLanguageTypeC_plus_plus) { @@ -292,9 +292,9 @@ return; } - if (ClangASTContext::IsObjCClassType(self_clang_type)) { + if (TypeSystemClang::IsObjCClassType(self_clang_type)) { return; - } else if (ClangASTContext::IsObjCObjectPointerType( + } else if (TypeSystemClang::IsObjCObjectPointerType( self_clang_type)) { m_in_objectivec_method = true; m_needs_object_ptr = true; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -27,7 +27,7 @@ #include "lldb/Core/dwarf.h" #include "lldb/Expression/IRExecutionUnit.h" #include "lldb/Expression/IRInterpreter.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Utility/ConstString.h" @@ -284,7 +284,7 @@ m_result_type = lldb_private::TypeFromParser( element_qual_type.getAsOpaquePtr(), - lldb_private::ClangASTContext::GetASTContext( + lldb_private::TypeSystemClang::GetASTContext( &result_decl->getASTContext())); } else if (pointer_objcobjpointertype) { clang::QualType element_qual_type = @@ -292,7 +292,7 @@ m_result_type = lldb_private::TypeFromParser( element_qual_type.getAsOpaquePtr(), - lldb_private::ClangASTContext::GetASTContext( + lldb_private::TypeSystemClang::GetASTContext( &result_decl->getASTContext())); } else { LLDB_LOG(log, "Expected result to have pointer type, but it did not"); @@ -306,7 +306,7 @@ } else { m_result_type = lldb_private::TypeFromParser( result_var->getType().getAsOpaquePtr(), - lldb_private::ClangASTContext::GetASTContext( + lldb_private::TypeSystemClang::GetASTContext( &result_decl->getASTContext())); } @@ -1093,7 +1093,7 @@ lldb_private::TypeFromParser result_decl_type( decl->getType().getAsOpaquePtr(), - lldb_private::ClangASTContext::GetASTContext(&decl->getASTContext())); + lldb_private::TypeSystemClang::GetASTContext(&decl->getASTContext())); StringRef decl_name(decl->getName()); lldb_private::ConstString persistent_variable_name(decl_name.data(), @@ -1224,7 +1224,7 @@ return false; lldb_private::CompilerType compiler_type( - lldb_private::ClangASTContext::GetASTContext( + lldb_private::TypeSystemClang::GetASTContext( &value_decl->getASTContext()), value_decl->getType().getAsOpaquePtr()); diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -10,7 +10,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTImporter.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" @@ -45,12 +45,12 @@ if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), - std::move(err), "Failed to get scratch ClangASTContext"); + std::move(err), "Failed to get scratch TypeSystemClang"); return; } - ClangASTContext *clang_ast_context = - llvm::dyn_cast(&type_system_or_err.get()); + TypeSystemClang *clang_ast_context = + llvm::dyn_cast(&type_system_or_err.get()); if (!clang_ast_context) { return; diff --git a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp @@ -16,7 +16,7 @@ #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/Host/Time.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -17,7 +17,7 @@ #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/DataFormatters/VectorIterator.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" @@ -241,8 +241,8 @@ auto addr(m_pair_ptr->GetValueAsUnsigned(LLDB_INVALID_ADDRESS)); m_pair_ptr = nullptr; if (addr && addr != LLDB_INVALID_ADDRESS) { - ClangASTContext *ast_ctx = - llvm::dyn_cast_or_null(pair_type.GetTypeSystem()); + TypeSystemClang *ast_ctx = + llvm::dyn_cast_or_null(pair_type.GetTypeSystem()); if (!ast_ctx) return false; CompilerType tree_node_type = ast_ctx->CreateStructForIdentifier( @@ -572,8 +572,8 @@ location_sp->GetPointeeData(extractor, 0, size); // std::wstring::size() is measured in 'characters', not bytes - ClangASTContext *ast_context = - ClangASTContext::GetScratch(*valobj.GetTargetSP()); + TypeSystemClang *ast_context = + TypeSystemClang::GetScratch(*valobj.GetTargetSP()); if (!ast_context) return false; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp @@ -8,7 +8,7 @@ #include "LibCxx.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Target.h" using namespace lldb; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" @@ -298,8 +298,8 @@ UINT32_MAX) { m_skip_size = bit_offset / 8u; } else { - ClangASTContext *ast_ctx = - llvm::dyn_cast_or_null(node_type.GetTypeSystem()); + TypeSystemClang *ast_ctx = + llvm::dyn_cast_or_null(node_type.GetTypeSystem()); if (!ast_ctx) return; CompilerType tree_node_type = ast_ctx->CreateStructForIdentifier( diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/VectorIterator.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" diff --git a/lldb/source/Plugins/Language/ObjC/CF.cpp b/lldb/source/Plugins/Language/ObjC/CF.cpp --- a/lldb/source/Plugins/Language/ObjC/CF.cpp +++ b/lldb/source/Plugins/Language/ObjC/CF.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Language.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -15,7 +15,7 @@ #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/Host/Time.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Language.h" #include "lldb/Target/Process.h" #include "lldb/Target/ProcessStructReader.h" diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -16,7 +16,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Expression/FunctionCaller.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Language.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" @@ -436,7 +436,7 @@ : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), m_id_type() { if (valobj_sp) { - auto *clang_ast_context = ClangASTContext::GetScratch( + auto *clang_ast_context = TypeSystemClang::GetScratch( *valobj_sp->GetExecutionContextRef().GetTargetSP()); if (clang_ast_context) m_id_type = CompilerType( @@ -584,7 +584,7 @@ if (valobj_sp) { CompilerType type = valobj_sp->GetCompilerType(); if (type) { - auto *clang_ast_context = ClangASTContext::GetScratch( + auto *clang_ast_context = TypeSystemClang::GetScratch( *valobj_sp->GetExecutionContextRef().GetTargetSP()); if (clang_ast_context) m_id_type = clang_ast_context->GetType( @@ -753,7 +753,7 @@ if (idx == 0) { auto *clang_ast_context = - ClangASTContext::GetScratch(*m_backend.GetTargetSP()); + TypeSystemClang::GetScratch(*m_backend.GetTargetSP()); if (clang_ast_context) { CompilerType id_type( clang_ast_context->GetBasicType(lldb::eBasicTypeObjCID)); diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -17,7 +17,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Language.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" @@ -65,7 +65,7 @@ static CompilerType GetLLDBNSPairType(TargetSP target_sp) { CompilerType compiler_type; - ClangASTContext *target_ast_context = ClangASTContext::GetScratch(*target_sp); + TypeSystemClang *target_ast_context = TypeSystemClang::GetScratch(*target_sp); if (target_ast_context) { ConstString g___lldb_autogen_nspair("__lldb_autogen_nspair"); @@ -80,14 +80,14 @@ clang::TTK_Struct, lldb::eLanguageTypeC); if (compiler_type) { - ClangASTContext::StartTagDeclarationDefinition(compiler_type); + TypeSystemClang::StartTagDeclarationDefinition(compiler_type); CompilerType id_compiler_type = target_ast_context->GetBasicType(eBasicTypeObjCID); - ClangASTContext::AddFieldToRecordType( + TypeSystemClang::AddFieldToRecordType( compiler_type, "key", id_compiler_type, lldb::eAccessPublic, 0); - ClangASTContext::AddFieldToRecordType( + TypeSystemClang::AddFieldToRecordType( compiler_type, "value", id_compiler_type, lldb::eAccessPublic, 0); - ClangASTContext::CompleteTagDeclarationDefinition(compiler_type); + TypeSystemClang::CompleteTagDeclarationDefinition(compiler_type); } } } diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp --- a/lldb/source/Plugins/Language/ObjC/NSError.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" @@ -87,7 +87,7 @@ ValueObjectSP domain_str_sp = ValueObject::CreateValueObjectFromData( "domain_str", isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), - ClangASTContext::GetScratch(process_sp->GetTarget()) + TypeSystemClang::GetScratch(process_sp->GetTarget()) ->GetBasicType(lldb::eBasicTypeVoid) .GetPointerType()); @@ -156,7 +156,7 @@ m_child_sp = CreateValueObjectFromData( "_userInfo", isw.GetAsData(process_sp->GetByteOrder()), m_backend.GetExecutionContextRef(), - ClangASTContext::GetScratch(process_sp->GetTarget()) + TypeSystemClang::GetScratch(process_sp->GetTarget()) ->GetBasicType(lldb::eBasicTypeObjCID)); return false; } diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp --- a/lldb/source/Plugins/Language/ObjC/NSException.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" @@ -69,7 +69,7 @@ InferiorSizedWord userinfo_isw(userinfo, *process_sp); InferiorSizedWord reserved_isw(reserved, *process_sp); - auto *clang_ast_context = ClangASTContext::GetScratch(process_sp->GetTarget()); + auto *clang_ast_context = TypeSystemClang::GetScratch(process_sp->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/DataFormatters/TypeSynthetic.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -53,7 +53,7 @@ if (!type_system) return false; - ClangASTContext *ast = ClangASTContext::GetScratch( + TypeSystemClang *ast = TypeSystemClang::GetScratch( *m_backend.GetExecutionContextRef().GetTargetSP()); if (!ast) return false; diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp --- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Language.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp --- a/lldb/source/Plugins/Language/ObjC/NSString.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/DataFormatters/StringPrinter.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/Language.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/Target.h" @@ -35,7 +35,7 @@ static CompilerType GetNSPathStore2Type(Target &target) { static ConstString g_type_name("__lldb_autogen_nspathstore2"); - ClangASTContext *ast_ctx = ClangASTContext::GetScratch(target); + TypeSystemClang *ast_ctx = TypeSystemClang::GetScratch(target); if (!ast_ctx) return CompilerType(); diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp @@ -20,7 +20,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/UniqueCStringMap.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContext.h" diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -21,7 +21,7 @@ #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" @@ -118,7 +118,7 @@ if (class_types.GetSize() == 1) { type_sp = class_types.GetTypeAtIndex(0); if (type_sp) { - if (ClangASTContext::IsCXXClassType( + if (TypeSystemClang::IsCXXClassType( type_sp->GetForwardCompilerType())) { LLDB_LOGF( log, @@ -150,7 +150,7 @@ for (i = 0; i < class_types.GetSize(); i++) { type_sp = class_types.GetTypeAtIndex(i); if (type_sp) { - if (ClangASTContext::IsCXXClassType( + if (TypeSystemClang::IsCXXClassType( type_sp->GetForwardCompilerType())) { LLDB_LOGF( log, @@ -238,7 +238,7 @@ if (!type) return true; - if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(), type)) { + if (TypeSystemClang::AreTypesSame(in_value.GetCompilerType(), type)) { // The dynamic type we found was the same type, so we don't have a // dynamic type here... return false; @@ -536,8 +536,8 @@ if (!thread_sp->SafeToCallFunctions()) return {}; - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(m_process->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(m_process->GetTarget()); if (!clang_ast_context) return {}; 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 @@ -9,7 +9,7 @@ #ifndef liblldb_AppleObjCDeclVendor_h_ #define liblldb_AppleObjCDeclVendor_h_ -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/lldb-private.h" #include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h" @@ -37,7 +37,7 @@ bool FinishDecl(clang::ObjCInterfaceDecl *decl); ObjCLanguageRuntime &m_runtime; - ClangASTContext m_ast_ctx; + TypeSystemClang m_ast_ctx; ObjCLanguageRuntime::EncodingToTypeSP m_type_realizer_sp; AppleObjCExternalASTSource *m_external_source; 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 @@ -308,7 +308,7 @@ } clang::ObjCMethodDecl * - BuildMethod(ClangASTContext &clang_ast_ctxt, + BuildMethod(TypeSystemClang &clang_ast_ctxt, clang::ObjCInterfaceDecl *interface_decl, const char *name, bool instance, ObjCLanguageRuntime::EncodingToTypeSP type_realizer_sp) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -24,7 +24,7 @@ #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -114,13 +114,13 @@ Target *target = exe_ctx.GetTargetPtr(); CompilerType compiler_type = value.GetCompilerType(); if (compiler_type) { - if (!ClangASTContext::IsObjCObjectPointerType(compiler_type)) { + if (!TypeSystemClang::IsObjCObjectPointerType(compiler_type)) { strm.Printf("Value doesn't point to an ObjC object.\n"); return false; } } else { // If it is not a pointer, see if we can make it into a pointer. - ClangASTContext *ast_context = ClangASTContext::GetScratch(*target); + TypeSystemClang *ast_context = TypeSystemClang::GetScratch(*target); if (!ast_context) return false; @@ -135,7 +135,7 @@ arg_value_list.PushValue(value); // This is the return value: - ClangASTContext *ast_context = ClangASTContext::GetScratch(*target); + TypeSystemClang *ast_context = TypeSystemClang::GetScratch(*target); if (!ast_context) return false; @@ -508,8 +508,8 @@ reserved_dict = reserved_dict->GetSyntheticValue(); if (!reserved_dict) return ThreadSP(); - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(*exception_sp->GetTargetSP()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(*exception_sp->GetTargetSP()); if (!clang_ast_context) return ThreadSP(); CompilerType objc_id = diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -18,7 +18,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -35,7 +35,7 @@ #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionValueBoolean.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/TypeList.h" @@ -1301,7 +1301,7 @@ return DescriptorMapUpdateResult::Fail(); thread_sp->CalculateExecutionContext(exe_ctx); - ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); if (!ast) return DescriptorMapUpdateResult::Fail(); @@ -1563,7 +1563,7 @@ return DescriptorMapUpdateResult::Fail(); thread_sp->CalculateExecutionContext(exe_ctx); - ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); if (!ast) return DescriptorMapUpdateResult::Fail(); @@ -2642,8 +2642,8 @@ const lldb::ABISP &abi = process_sp->GetABI(); if (!abi) return; - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(process_sp->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(process_sp->GetTarget()); if (!clang_ast_context) return; CompilerType voidstar = diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -19,7 +19,7 @@ #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UserExpression.h" #include "lldb/Expression/UtilityFunction.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContext.h" @@ -521,8 +521,8 @@ Process *process = exe_ctx.GetProcessPtr(); const ABI *abi = process->GetABI().get(); - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(process->GetTarget()); if (!clang_ast_context) return false; @@ -804,8 +804,8 @@ } // Next make the runner function for our implementation utility function. - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); if (!clang_ast_context) return LLDB_INVALID_ADDRESS; @@ -901,7 +901,7 @@ TargetSP target_sp(thread.CalculateTarget()); - ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); if (!clang_ast_context) return ret_plan_sp; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h @@ -22,7 +22,7 @@ AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime); ~AppleObjCTypeEncodingParser() override = default; - CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name, + CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name, bool for_expression) override; private: @@ -35,29 +35,29 @@ ~StructElement() = default; }; - clang::QualType BuildType(ClangASTContext &clang_ast_ctx, StringLexer &type, + clang::QualType BuildType(TypeSystemClang &clang_ast_ctx, StringLexer &type, bool for_expression, uint32_t *bitfield_bit_size = nullptr); - clang::QualType BuildStruct(ClangASTContext &ast_ctx, StringLexer &type, + clang::QualType BuildStruct(TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression); - clang::QualType BuildAggregate(ClangASTContext &clang_ast_ctx, + clang::QualType BuildAggregate(TypeSystemClang &clang_ast_ctx, StringLexer &type, bool for_expression, char opener, char closer, uint32_t kind); - clang::QualType BuildUnion(ClangASTContext &ast_ctx, StringLexer &type, + clang::QualType BuildUnion(TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression); - clang::QualType BuildArray(ClangASTContext &ast_ctx, StringLexer &type, + clang::QualType BuildArray(TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression); std::string ReadStructName(StringLexer &type); - StructElement ReadStructElement(ClangASTContext &ast_ctx, StringLexer &type, + StructElement ReadStructElement(TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression); - clang::QualType BuildObjCObjectPointerType(ClangASTContext &clang_ast_ctx, + clang::QualType BuildObjCObjectPointerType(TypeSystemClang &clang_ast_ctx, StringLexer &type, bool for_expression); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -8,7 +8,7 @@ #include "AppleObjCTypeEncodingParser.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Process.h" @@ -23,7 +23,7 @@ ObjCLanguageRuntime &runtime) : ObjCLanguageRuntime::EncodingToType(), m_runtime(runtime) { if (!m_scratch_ast_ctx_up) - m_scratch_ast_ctx_up.reset(new ClangASTContext( + m_scratch_ast_ctx_up.reset(new TypeSystemClang( "AppleObjCTypeEncodingParser ASTContext", runtime.GetProcess()->GetTarget().GetArchitecture().GetTriple())); } @@ -60,7 +60,7 @@ : name(""), type(clang::QualType()), bitfield(0) {} AppleObjCTypeEncodingParser::StructElement -AppleObjCTypeEncodingParser::ReadStructElement(ClangASTContext &ast_ctx, +AppleObjCTypeEncodingParser::ReadStructElement(TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression) { StructElement retval; @@ -75,19 +75,19 @@ } clang::QualType AppleObjCTypeEncodingParser::BuildStruct( - ClangASTContext &ast_ctx, StringLexer &type, bool for_expression) { + TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression) { return BuildAggregate(ast_ctx, type, for_expression, '{', '}', clang::TTK_Struct); } clang::QualType AppleObjCTypeEncodingParser::BuildUnion( - ClangASTContext &ast_ctx, StringLexer &type, bool for_expression) { + TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression) { return BuildAggregate(ast_ctx, type, for_expression, '(', ')', clang::TTK_Union); } clang::QualType AppleObjCTypeEncodingParser::BuildAggregate( - ClangASTContext &ast_ctx, StringLexer &type, bool for_expression, + TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression, char opener, char closer, uint32_t kind) { if (!type.NextIf(opener)) return clang::QualType(); @@ -124,7 +124,7 @@ CompilerType union_type(ast_ctx.CreateRecordType( nullptr, lldb::eAccessPublic, name, kind, lldb::eLanguageTypeC)); if (union_type) { - ClangASTContext::StartTagDeclarationDefinition(union_type); + TypeSystemClang::StartTagDeclarationDefinition(union_type); unsigned int count = 0; for (auto element : elements) { @@ -133,18 +133,18 @@ elem_name.Printf("__unnamed_%u", count); element.name = elem_name.GetString(); } - ClangASTContext::AddFieldToRecordType( + TypeSystemClang::AddFieldToRecordType( union_type, element.name.c_str(), ast_ctx.GetType(element.type), lldb::eAccessPublic, element.bitfield); ++count; } - ClangASTContext::CompleteTagDeclarationDefinition(union_type); + TypeSystemClang::CompleteTagDeclarationDefinition(union_type); } return ClangUtil::GetQualType(union_type); } clang::QualType AppleObjCTypeEncodingParser::BuildArray( - ClangASTContext &ast_ctx, StringLexer &type, bool for_expression) { + TypeSystemClang &ast_ctx, StringLexer &type, bool for_expression) { if (!type.NextIf('[')) return clang::QualType(); uint32_t size = ReadNumber(type); @@ -162,7 +162,7 @@ // consume but ignore the type info and always return an 'id'; if anything, // dynamic typing will resolve things for us anyway clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType( - ClangASTContext &clang_ast_ctx, StringLexer &type, bool for_expression) { + TypeSystemClang &clang_ast_ctx, StringLexer &type, bool for_expression) { if (!type.NextIf('@')) return clang::QualType(); @@ -246,7 +246,7 @@ } clang::QualType -AppleObjCTypeEncodingParser::BuildType(ClangASTContext &clang_ast_ctx, +AppleObjCTypeEncodingParser::BuildType(TypeSystemClang &clang_ast_ctx, StringLexer &type, bool for_expression, uint32_t *bitfield_bit_size) { if (!type.HasAtLeast(1)) @@ -352,7 +352,7 @@ } } -CompilerType AppleObjCTypeEncodingParser::RealizeType(ClangASTContext &ast_ctx, +CompilerType AppleObjCTypeEncodingParser::RealizeType(TypeSystemClang &ast_ctx, const char *name, bool for_expression) { if (name && name[0]) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h @@ -144,12 +144,12 @@ public: virtual ~EncodingToType(); - virtual CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name, + virtual CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name, bool for_expression) = 0; virtual CompilerType RealizeType(const char *name, bool for_expression); protected: - std::unique_ptr m_scratch_ast_ctx_up; + std::unique_ptr m_scratch_ast_ctx_up; }; class ObjCExceptionPrecondition : public BreakpointPrecondition { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/ValueObject.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/Type.h" @@ -127,7 +127,7 @@ for (uint32_t i = 0; i < types.GetSize(); ++i) { TypeSP type_sp(types.GetTypeAtIndex(i)); - if (ClangASTContext::IsObjCObjectOrInterfaceType( + if (TypeSystemClang::IsObjCObjectOrInterfaceType( type_sp->GetForwardCompilerType())) { if (type_sp->IsCompleteObjCClass()) { m_complete_class_cache[name] = type_sp; @@ -387,9 +387,9 @@ CompilerType class_type; bool is_pointer_type = false; - if (ClangASTContext::IsObjCObjectPointerType(base_type, &class_type)) + if (TypeSystemClang::IsObjCObjectPointerType(base_type, &class_type)) is_pointer_type = true; - else if (ClangASTContext::IsObjCObjectOrInterfaceType(base_type)) + else if (TypeSystemClang::IsObjCObjectOrInterfaceType(base_type)) class_type = base_type; else return llvm::None; diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -22,7 +22,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ProcessLaunchInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -706,7 +706,7 @@ FunctionCaller *do_dlopen_function = nullptr; // Fetch the clang types we will need: - ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); if (!ast) return nullptr; @@ -950,9 +950,9 @@ Value return_value; // Fetch the clang types we will need: - ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget()); + TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); if (!ast) { - error.SetErrorString("dlopen error: Unable to get ClangASTContext"); + error.SetErrorString("dlopen error: Unable to get TypeSystemClang"); return LLDB_INVALID_IMAGE_TOKEN; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h @@ -21,7 +21,7 @@ #include "LogChannelDWARF.h" #include "lldb/Core/ClangForward.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTImporter.h" #include @@ -36,7 +36,7 @@ class DWARFASTParserClang : public DWARFASTParser { public: - DWARFASTParserClang(lldb_private::ClangASTContext &ast); + DWARFASTParserClang(lldb_private::TypeSystemClang &ast); ~DWARFASTParserClang() override; @@ -82,7 +82,7 @@ DIEToDeclMap; typedef llvm::DenseMap DeclToDIEMap; - lldb_private::ClangASTContext &m_ast; + lldb_private::TypeSystemClang &m_ast; DIEToDeclMap m_die_to_decl; DeclToDIEMap m_decl_to_die; DIEToDeclContextMap m_die_to_decl_ctx; @@ -97,11 +97,11 @@ clang::NamespaceDecl *ResolveNamespaceDIE(const DWARFDIE &die); bool ParseTemplateDIE(const DWARFDIE &die, - lldb_private::ClangASTContext::TemplateParameterInfos + lldb_private::TypeSystemClang::TemplateParameterInfos &template_param_infos); bool ParseTemplateParameterInfos( const DWARFDIE &parent_die, - lldb_private::ClangASTContext::TemplateParameterInfos + lldb_private::TypeSystemClang::TemplateParameterInfos &template_param_infos); bool ParseChildMembers( diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -55,7 +55,7 @@ using namespace lldb; using namespace lldb_private; -DWARFASTParserClang::DWARFASTParserClang(ClangASTContext &ast) +DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast) : m_ast(ast), m_die_to_decl_ctx(), m_decl_ctx_to_die() {} DWARFASTParserClang::~DWARFASTParserClang() {} @@ -243,7 +243,7 @@ dwarf->GetTypeList().Insert(type_sp); dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); - clang::TagDecl *tag_decl = ClangASTContext::GetAsTagDecl(type); + clang::TagDecl *tag_decl = TypeSystemClang::GetAsTagDecl(type); if (tag_decl) LinkDeclContextToDIE(tag_decl, die); else { @@ -255,7 +255,7 @@ return type_sp; } -static void CompleteExternalTagDeclType(ClangASTContext &ast, +static void CompleteExternalTagDeclType(TypeSystemClang &ast, ClangASTImporter &ast_importer, clang::DeclContext *decl_ctx, DWARFDIE die, @@ -277,8 +277,8 @@ type_name_cstr ? type_name_cstr : "", die.GetOffset()); // We need to make the type look complete otherwise, we might crash in // Clang when adding children. - if (ClangASTContext::StartTagDeclarationDefinition(type)) - ClangASTContext::CompleteTagDeclarationDefinition(type); + if (TypeSystemClang::StartTagDeclarationDefinition(type)) + TypeSystemClang::CompleteTagDeclarationDefinition(type); } } @@ -824,21 +824,21 @@ m_ast.GetEnumerationIntegerType(clang_type.GetOpaqueQualType()); } - LinkDeclContextToDIE(ClangASTContext::GetDeclContextForType(clang_type), die); + LinkDeclContextToDIE(TypeSystemClang::GetDeclContextForType(clang_type), die); type_sp = std::make_shared( die.GetID(), dwarf, attrs.name, attrs.byte_size, nullptr, dwarf->GetUID(attrs.type.Reference()), Type::eEncodingIsUID, &attrs.decl, clang_type, Type::ResolveState::Forward); - if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) { + if (TypeSystemClang::StartTagDeclarationDefinition(clang_type)) { if (die.HasChildren()) { bool is_signed = false; enumerator_clang_type.IsIntegerType(is_signed); ParseChildEnumerators(clang_type, is_signed, type_sp->GetByteSize().getValueOr(0), die); } - ClangASTContext::CompleteTagDeclarationDefinition(clang_type); + TypeSystemClang::CompleteTagDeclarationDefinition(clang_type); } else { dwarf->GetObjectFile()->GetModule()->ReportError( "DWARF DIE at 0x%8.8x named \"%s\" was not able to start its " @@ -948,7 +948,7 @@ if (complete_objc_class_type_sp) { CompilerType type_clang_forward_type = complete_objc_class_type_sp->GetForwardCompilerType(); - if (ClangASTContext::IsObjCObjectOrInterfaceType( + if (TypeSystemClang::IsObjCObjectOrInterfaceType( type_clang_forward_type)) class_opaque_type = type_clang_forward_type; } @@ -1053,7 +1053,7 @@ } else { CompilerType class_opaque_type = class_type->GetForwardCompilerType(); - if (ClangASTContext::IsCXXClassType(class_opaque_type)) { + if (TypeSystemClang::IsCXXClassType(class_opaque_type)) { if (class_opaque_type.IsBeingDefined() || alternate_defn) { if (!is_static && !die.HasChildren()) { // We have a C++ member function with no children (this @@ -1206,7 +1206,7 @@ attrs.is_inline); if (has_template_params) { - ClangASTContext::TemplateParameterInfos template_param_infos; + TypeSystemClang::TemplateParameterInfos template_param_infos; ParseTemplateParameterInfos(die, template_param_infos); template_function_decl = m_ast.CreateFunctionDeclaration( ignore_containing_context ? m_ast.GetTranslationUnitDecl() @@ -1279,7 +1279,7 @@ attrs.byte_stride = element_type->GetByteSize().getValueOr(0); CompilerType array_element_type = element_type->GetForwardCompilerType(); - if (ClangASTContext::IsCXXClassType(array_element_type) && + if (TypeSystemClang::IsCXXClassType(array_element_type) && !array_element_type.GetCompleteType()) { ModuleSP module_sp = die.GetModule(); if (module_sp) { @@ -1306,8 +1306,8 @@ // trying to layout the class. Since we provide layout // assistance, all ivars in this class and other classes will be // fine, this is the best we can do short of crashing. - if (ClangASTContext::StartTagDeclarationDefinition(array_element_type)) { - ClangASTContext::CompleteTagDeclarationDefinition(array_element_type); + if (TypeSystemClang::StartTagDeclarationDefinition(array_element_type)) { + TypeSystemClang::CompleteTagDeclarationDefinition(array_element_type); } else { module_sp->ReportError("DWARF DIE at 0x%8.8x was not able to " "start its definition.\nPlease file a " @@ -1357,7 +1357,7 @@ CompilerType pointee_clang_type = pointee_type->GetForwardCompilerType(); CompilerType class_clang_type = class_type->GetLayoutCompilerType(); - CompilerType clang_type = ClangASTContext::CreateMemberPointerType( + CompilerType clang_type = TypeSystemClang::CreateMemberPointerType( class_clang_type, pointee_clang_type); if (llvm::Optional clang_type_size = @@ -1611,7 +1611,7 @@ metadata.SetIsDynamicCXXType(dwarf->ClassOrStructIsVirtual(die)); if (attrs.name.GetStringRef().contains('<')) { - ClangASTContext::TemplateParameterInfos template_param_infos; + TypeSystemClang::TemplateParameterInfos template_param_infos; if (ParseTemplateParameterInfos(die, template_param_infos)) { clang::ClassTemplateDecl *class_template_decl = m_ast.ParseClassTemplateDecl(decl_ctx, attrs.accessibility, @@ -1705,8 +1705,8 @@ // these child definitions. if (!die.HasChildren()) { // No children for this struct/union/class, lets finish it - if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) { - ClangASTContext::CompleteTagDeclarationDefinition(clang_type); + if (TypeSystemClang::StartTagDeclarationDefinition(clang_type)) { + TypeSystemClang::CompleteTagDeclarationDefinition(clang_type); } else { dwarf->GetObjectFile()->GetModule()->ReportError( "DWARF DIE at 0x%8.8x named \"%s\" was not able to start its " @@ -1718,7 +1718,7 @@ if (tag == DW_TAG_structure_type) // this only applies in C { clang::RecordDecl *record_decl = - ClangASTContext::GetAsRecordDecl(clang_type); + TypeSystemClang::GetAsRecordDecl(clang_type); if (record_decl) { GetClangASTImporter().SetRecordLayout( @@ -1736,7 +1736,7 @@ if (attrs.class_language != eLanguageTypeObjC && attrs.class_language != eLanguageTypeObjC_plus_plus) - ClangASTContext::StartTagDeclarationDefinition(clang_type); + TypeSystemClang::StartTagDeclarationDefinition(clang_type); // Leave this as a forward declaration until we need to know the // details of the type. lldb_private::Type will automatically call @@ -1826,7 +1826,7 @@ } bool Finalize() { - return ClangASTContext::AddObjCClassProperty( + return TypeSystemClang::AddObjCClassProperty( m_class_opaque_type, m_property_name, m_property_opaque_type, m_ivar_decl, m_property_setter_name, m_property_getter_name, m_property_attributes, m_metadata_up.get()); @@ -1845,14 +1845,14 @@ bool DWARFASTParserClang::ParseTemplateDIE( const DWARFDIE &die, - ClangASTContext::TemplateParameterInfos &template_param_infos) { + TypeSystemClang::TemplateParameterInfos &template_param_infos) { const dw_tag_t tag = die.Tag(); bool is_template_template_argument = false; switch (tag) { case DW_TAG_GNU_template_parameter_pack: { template_param_infos.packed_args.reset( - new ClangASTContext::TemplateParameterInfos); + new TypeSystemClang::TemplateParameterInfos); for (DWARFDIE child_die = die.GetFirstChild(); child_die.IsValid(); child_die = child_die.GetSibling()) { if (!ParseTemplateDIE(child_die, *template_param_infos.packed_args)) @@ -1954,7 +1954,7 @@ bool DWARFASTParserClang::ParseTemplateParameterInfos( const DWARFDIE &parent_die, - ClangASTContext::TemplateParameterInfos &template_param_infos) { + TypeSystemClang::TemplateParameterInfos &template_param_infos) { if (!parent_die) return false; @@ -1991,11 +1991,11 @@ { if (die.HasChildren()) { LanguageType class_language = eLanguageTypeUnknown; - if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type)) { + if (TypeSystemClang::IsObjCObjectOrInterfaceType(clang_type)) { class_language = eLanguageTypeObjC; // For objective C we don't start the definition when the class is // created. - ClangASTContext::StartTagDeclarationDefinition(clang_type); + TypeSystemClang::StartTagDeclarationDefinition(clang_type); } int tag_decl_kind = -1; @@ -2105,9 +2105,9 @@ // provide layout assistance, all ivars in this class and other // classes will be fine, this is the best we can do short of // crashing. - if (ClangASTContext::StartTagDeclarationDefinition( + if (TypeSystemClang::StartTagDeclarationDefinition( base_class_type)) { - ClangASTContext::CompleteTagDeclarationDefinition( + TypeSystemClang::CompleteTagDeclarationDefinition( base_class_type); } } @@ -2121,8 +2121,8 @@ } m_ast.AddMethodOverridesForCXXRecordType(clang_type.GetOpaqueQualType()); - ClangASTContext::BuildIndirectFields(clang_type); - ClangASTContext::CompleteTagDeclarationDefinition(clang_type); + TypeSystemClang::BuildIndirectFields(clang_type); + TypeSystemClang::CompleteTagDeclarationDefinition(clang_type); if (!layout_info.field_offsets.empty() || !layout_info.base_offsets.empty() || !layout_info.vbase_offsets.empty()) { @@ -2144,14 +2144,14 @@ bool DWARFASTParserClang::CompleteEnumType(const DWARFDIE &die, lldb_private::Type *type, CompilerType &clang_type) { - if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) { + if (TypeSystemClang::StartTagDeclarationDefinition(clang_type)) { if (die.HasChildren()) { bool is_signed = false; clang_type.IsIntegerType(is_signed); ParseChildEnumerators(clang_type, is_signed, type->GetByteSize().getValueOr(0), die); } - ClangASTContext::CompleteTagDeclarationDefinition(clang_type); + TypeSystemClang::CompleteTagDeclarationDefinition(clang_type); } return (bool)clang_type; } @@ -2592,7 +2592,7 @@ if (var_type) { if (accessibility == eAccessNone) accessibility = eAccessPublic; - ClangASTContext::AddVariableToRecordType( + TypeSystemClang::AddVariableToRecordType( class_clang_type, name, var_type->GetLayoutCompilerType(), accessibility); } @@ -2735,7 +2735,7 @@ if (anon_field_info.IsValid()) { clang::FieldDecl *unnamed_bitfield_decl = - ClangASTContext::AddFieldToRecordType( + TypeSystemClang::AddFieldToRecordType( class_clang_type, llvm::StringRef(), m_ast.GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, word_width), @@ -2791,7 +2791,7 @@ } } - if (ClangASTContext::IsCXXClassType(member_clang_type) && + if (TypeSystemClang::IsCXXClassType(member_clang_type) && !member_clang_type.GetCompleteType()) { if (die.GetCU()->GetProducer() == eProducerClang) module_sp->ReportError( @@ -2814,9 +2814,9 @@ // when trying to layout the class. Since we provide layout // assistance, all ivars in this class and other classes will // be fine, this is the best we can do short of crashing. - if (ClangASTContext::StartTagDeclarationDefinition( + if (TypeSystemClang::StartTagDeclarationDefinition( member_clang_type)) { - ClangASTContext::CompleteTagDeclarationDefinition( + TypeSystemClang::CompleteTagDeclarationDefinition( member_clang_type); } else { module_sp->ReportError( @@ -2830,7 +2830,7 @@ } } - field_decl = ClangASTContext::AddFieldToRecordType( + field_decl = TypeSystemClang::AddFieldToRecordType( class_clang_type, name, member_clang_type, accessibility, bit_size); @@ -2888,8 +2888,8 @@ BitfieldInfo last_field_info; ModuleSP module_sp = parent_die.GetDWARF()->GetObjectFile()->GetModule(); - ClangASTContext *ast = - llvm::dyn_cast_or_null(class_clang_type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast_or_null(class_clang_type.GetTypeSystem()); if (ast == nullptr) return false; @@ -3318,7 +3318,7 @@ if (dwarf && type) { const char *name = die.GetName(); clang::DeclContext *decl_context = - ClangASTContext::DeclContextGetAsDeclContext( + TypeSystemClang::DeclContextGetAsDeclContext( dwarf->GetDeclContextContainingUID(die.GetID())); decl = m_ast.CreateVariableDeclaration( decl_context, name, @@ -3333,7 +3333,7 @@ CompilerDecl imported_decl = imported_uid.GetDecl(); if (imported_decl) { clang::DeclContext *decl_context = - ClangASTContext::DeclContextGetAsDeclContext( + TypeSystemClang::DeclContextGetAsDeclContext( dwarf->GetDeclContextContainingUID(die.GetID())); if (clang::NamedDecl *clang_imported_decl = llvm::dyn_cast( @@ -3352,10 +3352,10 @@ CompilerDeclContext imported_decl_ctx = imported_uid.GetDeclContext(); if (imported_decl_ctx) { clang::DeclContext *decl_context = - ClangASTContext::DeclContextGetAsDeclContext( + TypeSystemClang::DeclContextGetAsDeclContext( dwarf->GetDeclContextContainingUID(die.GetID())); if (clang::NamespaceDecl *ns_decl = - ClangASTContext::DeclContextGetAsNamespaceDecl( + TypeSystemClang::DeclContextGetAsNamespaceDecl( imported_decl_ctx)) decl = m_ast.CreateUsingDirectiveDeclaration(decl_context, ns_decl); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -35,7 +35,7 @@ #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Symbol/Block.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/CompilerDecl.h" @@ -1392,8 +1392,8 @@ } TypeSystem *type_system = compiler_type.GetTypeSystem(); - ClangASTContext *clang_type_system = - llvm::dyn_cast_or_null(type_system); + TypeSystemClang *clang_type_system = + llvm::dyn_cast_or_null(type_system); if (!clang_type_system) return false; DWARFASTParserClang *ast_parser = @@ -1404,8 +1404,8 @@ bool SymbolFileDWARF::CompleteType(CompilerType &compiler_type) { std::lock_guard guard(GetModuleMutex()); - ClangASTContext *clang_type_system = - llvm::dyn_cast_or_null(compiler_type.GetTypeSystem()); + TypeSystemClang *clang_type_system = + llvm::dyn_cast_or_null(compiler_type.GetTypeSystem()); if (clang_type_system) { DWARFASTParserClang *ast_parser = static_cast(clang_type_system->GetDWARFParser()); @@ -3934,8 +3934,8 @@ auto ts_or_err = GetTypeSystemForLanguage(eLanguageTypeC_plus_plus); if (!ts_or_err) return; - ClangASTContext *clang = - llvm::dyn_cast_or_null(&ts_or_err.get()); + TypeSystemClang *clang = + llvm::dyn_cast_or_null(&ts_or_err.get()); if (!clang) return; clang->Dump(s); diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h @@ -51,7 +51,7 @@ class PdbAstBuilder { public: // Constructors and Destructors - PdbAstBuilder(ObjectFile &obj, PdbIndex &index, ClangASTContext &clang); + PdbAstBuilder(ObjectFile &obj, PdbIndex &index, TypeSystemClang &clang); lldb_private::CompilerDeclContext GetTranslationUnitDecl(); @@ -80,7 +80,7 @@ clang::Decl *FromCompilerDecl(CompilerDecl decl); clang::DeclContext *FromCompilerDeclContext(CompilerDeclContext context); - ClangASTContext &clang() { return m_clang; } + TypeSystemClang &clang() { return m_clang; } ClangASTImporter &importer() { return m_importer; } void Dump(Stream &stream); @@ -129,7 +129,7 @@ clang::QualType CreateSimpleType(TypeIndex ti); PdbIndex &m_index; - ClangASTContext &m_clang; + TypeSystemClang &m_clang; ClangASTImporter m_importer; diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -16,7 +16,7 @@ #include "Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h" #include "lldb/Core/Module.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTMetadata.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/ObjectFile.h" @@ -202,7 +202,7 @@ return name == "`anonymous namespace'" || name == "`anonymous-namespace'"; } -PdbAstBuilder::PdbAstBuilder(ObjectFile &obj, PdbIndex &index, ClangASTContext &clang) +PdbAstBuilder::PdbAstBuilder(ObjectFile &obj, PdbIndex &index, TypeSystemClang &clang) : m_index(index), m_clang(clang) { BuildParentMap(); } @@ -656,7 +656,7 @@ lldbassert(IsTagRecord(type_id, m_index.tpi())); clang::QualType tag_qt = m_clang.getASTContext().getTypeDeclType(&tag); - ClangASTContext::SetHasExternalStorage(tag_qt.getAsOpaquePtr(), false); + TypeSystemClang::SetHasExternalStorage(tag_qt.getAsOpaquePtr(), false); TypeIndex tag_ti = type_id.index; CVType cvt = m_index.tpi().getType(tag_ti); @@ -781,7 +781,7 @@ lldbassert(ct.IsValid()); - ClangASTContext::StartTagDeclarationDefinition(ct); + TypeSystemClang::StartTagDeclarationDefinition(ct); // Even if it's possible, don't complete it at this point. Just mark it // forward resolved, and if/when LLDB needs the full definition, it can @@ -789,7 +789,7 @@ clang::QualType result = clang::QualType::getFromOpaquePtr(ct.GetOpaqueQualType()); - ClangASTContext::SetHasExternalStorage(result.getAsOpaquePtr(), true); + TypeSystemClang::SetHasExternalStorage(result.getAsOpaquePtr(), true); return result; } @@ -1105,8 +1105,8 @@ uname.c_str(), decl_context, declaration, ToCompilerType(underlying_type), er.isScoped()); - ClangASTContext::StartTagDeclarationDefinition(enum_ct); - ClangASTContext::SetHasExternalStorage(enum_ct.GetOpaqueQualType(), true); + TypeSystemClang::StartTagDeclarationDefinition(enum_ct); + TypeSystemClang::SetHasExternalStorage(enum_ct.GetOpaqueQualType(), true); return clang::QualType::getFromOpaquePtr(enum_ct.GetOpaqueQualType()); } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -19,7 +19,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamBuffer.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" @@ -331,7 +331,7 @@ std::move(err), "Failed to initialize"); } else { ts_or_err->SetSymbolFile(this); - auto *clang = llvm::cast_or_null(&ts_or_err.get()); + auto *clang = llvm::cast_or_null(&ts_or_err.get()); lldbassert(clang); m_ast = std::make_unique(*m_objfile_sp, *m_index, *clang); } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp @@ -5,7 +5,7 @@ #include "PdbSymUid.h" #include "PdbUtil.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTImporter.h" #include "lldb/Symbol/Type.h" #include "lldb/Utility/LLDBAssert.h" @@ -128,7 +128,7 @@ lldb::AccessType access = TranslateMemberAccess(static_data_member.getAccess()); - ClangASTContext::AddVariableToRecordType( + TypeSystemClang::AddVariableToRecordType( m_derived_ct, static_data_member.Name, member_ct, access); // FIXME: Add a PdbSymUid namespace for field list members and update @@ -164,7 +164,7 @@ lldb::AccessType access = TranslateMemberAccess(data_member.getAccess()); - clang::FieldDecl *decl = ClangASTContext::AddFieldToRecordType( + clang::FieldDecl *decl = TypeSystemClang::AddFieldToRecordType( m_derived_ct, data_member.Name, m_ast_builder.ToCompilerType(member_qt), access, bitfield_width); // FIXME: Add a PdbSymUid namespace for field list members and update @@ -223,12 +223,12 @@ for (auto &ib : m_bases) bases.push_back(std::move(ib.second)); - ClangASTContext &clang = m_ast_builder.clang(); + TypeSystemClang &clang = m_ast_builder.clang(); clang.TransferBaseClasses(m_derived_ct.GetOpaqueQualType(), std::move(bases)); clang.AddMethodOverridesForCXXRecordType(m_derived_ct.GetOpaqueQualType()); - ClangASTContext::BuildIndirectFields(m_derived_ct); - ClangASTContext::CompleteTagDeclarationDefinition(m_derived_ct); + TypeSystemClang::BuildIndirectFields(m_derived_ct); + TypeSystemClang::CompleteTagDeclarationDefinition(m_derived_ct); if (auto *record_decl = llvm::dyn_cast(&m_tag_decl)) { m_ast_builder.importer().SetRecordLayout(record_decl, m_layout); diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h @@ -23,7 +23,7 @@ } // namespace clang namespace lldb_private { -class ClangASTContext; +class TypeSystemClang; class CompilerType; } // namespace lldb_private @@ -42,7 +42,7 @@ class PDBASTParser { public: - PDBASTParser(lldb_private::ClangASTContext &ast); + PDBASTParser(lldb_private::TypeSystemClang &ast); ~PDBASTParser(); lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type); @@ -103,7 +103,7 @@ lldb_private::CompilerType &record_type, const llvm::pdb::PDBSymbolFunc &method) const; - lldb_private::ClangASTContext &m_ast; + lldb_private::TypeSystemClang &m_ast; lldb_private::ClangASTImporter m_ast_importer; CXXRecordDeclToUidMap m_forward_decl_to_uid; diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -15,7 +15,7 @@ #include "clang/AST/DeclCXX.h" #include "lldb/Core/Module.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTMetadata.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/Declaration.h" @@ -100,7 +100,7 @@ } static CompilerType -GetBuiltinTypeForPDBEncodingAndBitSize(ClangASTContext &clang_ast, +GetBuiltinTypeForPDBEncodingAndBitSize(TypeSystemClang &clang_ast, const PDBSymbolTypeBuiltin &pdb_type, Encoding encoding, uint32_t width) { clang::ASTContext &ast = clang_ast.getASTContext(); @@ -353,7 +353,7 @@ } } -PDBASTParser::PDBASTParser(lldb_private::ClangASTContext &ast) : m_ast(ast) {} +PDBASTParser::PDBASTParser(lldb_private::TypeSystemClang &ast) : m_ast(ast) {} PDBASTParser::~PDBASTParser() {} @@ -422,15 +422,15 @@ m_ast.getASTContext(), GetMSInheritance(*udt)); record_decl->addAttr(inheritance_attr); - ClangASTContext::StartTagDeclarationDefinition(clang_type); + TypeSystemClang::StartTagDeclarationDefinition(clang_type); auto children = udt->findAllChildren(); if (!children || children->getChildCount() == 0) { // PDB does not have symbol of forwarder. We assume we get an udt w/o // any fields. Just complete it at this point. - ClangASTContext::CompleteTagDeclarationDefinition(clang_type); + TypeSystemClang::CompleteTagDeclarationDefinition(clang_type); - ClangASTContext::SetHasExternalStorage(clang_type.GetOpaqueQualType(), + TypeSystemClang::SetHasExternalStorage(clang_type.GetOpaqueQualType(), false); type_resolve_state = Type::ResolveState::Full; @@ -439,7 +439,7 @@ // an endless recursion in CompleteTypeFromUdt function. m_forward_decl_to_uid[record_decl] = type.getSymIndexId(); - ClangASTContext::SetHasExternalStorage(clang_type.GetOpaqueQualType(), + TypeSystemClang::SetHasExternalStorage(clang_type.GetOpaqueQualType(), true); type_resolve_state = Type::ResolveState::Forward; @@ -499,7 +499,7 @@ ast_enum = m_ast.CreateEnumerationType(name.c_str(), decl_context, decl, builtin_type, isScoped); - auto enum_decl = ClangASTContext::GetAsEnumDecl(ast_enum); + auto enum_decl = TypeSystemClang::GetAsEnumDecl(ast_enum); assert(enum_decl); m_uid_to_decl[type.getSymIndexId()] = enum_decl; @@ -512,8 +512,8 @@ } } - if (ClangASTContext::StartTagDeclarationDefinition(ast_enum)) - ClangASTContext::CompleteTagDeclarationDefinition(ast_enum); + if (TypeSystemClang::StartTagDeclarationDefinition(ast_enum)) + TypeSystemClang::CompleteTagDeclarationDefinition(ast_enum); } if (enum_type->isConstType()) @@ -553,7 +553,7 @@ if (!ast_typedef) return nullptr; - auto typedef_decl = ClangASTContext::GetAsTypedefDecl(ast_typedef); + auto typedef_decl = TypeSystemClang::GetAsTypedefDecl(ast_typedef); assert(typedef_decl); m_uid_to_decl[type.getSymIndexId()] = typedef_decl; } @@ -660,10 +660,10 @@ CompilerType element_ast_type = element_type->GetForwardCompilerType(); // If element type is UDT, it needs to be complete. - if (ClangASTContext::IsCXXClassType(element_ast_type) && + if (TypeSystemClang::IsCXXClassType(element_ast_type) && !element_ast_type.GetCompleteType()) { - if (ClangASTContext::StartTagDeclarationDefinition(element_ast_type)) { - ClangASTContext::CompleteTagDeclarationDefinition(element_ast_type); + if (TypeSystemClang::StartTagDeclarationDefinition(element_ast_type)) { + TypeSystemClang::CompleteTagDeclarationDefinition(element_ast_type); } else { // We are not able to start defintion. return nullptr; @@ -721,7 +721,7 @@ assert(class_parent_type); CompilerType pointer_ast_type; - pointer_ast_type = ClangASTContext::CreateMemberPointerType( + pointer_ast_type = TypeSystemClang::CreateMemberPointerType( class_parent_type->GetLayoutCompilerType(), pointee_type->GetForwardCompilerType()); assert(pointer_ast_type); @@ -787,7 +787,7 @@ m_forward_decl_to_uid.erase(uid_it); - ClangASTContext::SetHasExternalStorage(compiler_type.GetOpaqueQualType(), + TypeSystemClang::SetHasExternalStorage(compiler_type.GetOpaqueQualType(), false); switch (symbol->getSymTag()) { @@ -1190,8 +1190,8 @@ AddRecordMethods(symbol_file, compiler_type, *methods_enum); m_ast.AddMethodOverridesForCXXRecordType(compiler_type.GetOpaqueQualType()); - ClangASTContext::BuildIndirectFields(compiler_type); - ClangASTContext::CompleteTagDeclarationDefinition(compiler_type); + TypeSystemClang::BuildIndirectFields(compiler_type); + TypeSystemClang::CompleteTagDeclarationDefinition(compiler_type); clang::CXXRecordDecl *record_decl = m_ast.GetAsCXXRecordDecl(compiler_type.GetOpaqueQualType()); @@ -1225,8 +1225,8 @@ "which does not have a complete definition.", record_type.GetTypeName().GetCString(), member_name.c_str(), member_comp_type.GetTypeName().GetCString()); - if (ClangASTContext::StartTagDeclarationDefinition(member_comp_type)) - ClangASTContext::CompleteTagDeclarationDefinition(member_comp_type); + if (TypeSystemClang::StartTagDeclarationDefinition(member_comp_type)) + TypeSystemClang::CompleteTagDeclarationDefinition(member_comp_type); } auto access = TranslateMemberAccess(member->getAccess()); @@ -1239,7 +1239,7 @@ if (location_type == PDB_LocType::ThisRel) bit_size *= 8; - auto decl = ClangASTContext::AddFieldToRecordType( + auto decl = TypeSystemClang::AddFieldToRecordType( record_type, member_name.c_str(), member_comp_type, access, bit_size); if (!decl) continue; @@ -1255,7 +1255,7 @@ break; } case PDB_DataKind::StaticMember: { - auto decl = ClangASTContext::AddVariableToRecordType( + auto decl = TypeSystemClang::AddVariableToRecordType( record_type, member_name.c_str(), member_comp_type, access); if (!decl) continue; @@ -1289,8 +1289,8 @@ "which does not have a complete definition.", record_type.GetTypeName().GetCString(), base_comp_type.GetTypeName().GetCString()); - if (ClangASTContext::StartTagDeclarationDefinition(base_comp_type)) - ClangASTContext::CompleteTagDeclarationDefinition(base_comp_type); + if (TypeSystemClang::StartTagDeclarationDefinition(base_comp_type)) + TypeSystemClang::CompleteTagDeclarationDefinition(base_comp_type); } auto access = TranslateMemberAccess(base->getAccess()); @@ -1346,8 +1346,8 @@ ":: Class '%s' has a method '%s' whose type cannot be completed.", record_type.GetTypeName().GetCString(), method_comp_type.GetTypeName().GetCString()); - if (ClangASTContext::StartTagDeclarationDefinition(method_comp_type)) - ClangASTContext::CompleteTagDeclarationDefinition(method_comp_type); + if (TypeSystemClang::StartTagDeclarationDefinition(method_comp_type)) + TypeSystemClang::CompleteTagDeclarationDefinition(method_comp_type); } AccessType access = TranslateMemberAccess(method.getAccess()); diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -15,7 +15,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/ObjectFile.h" @@ -310,8 +310,8 @@ return nullptr; } - ClangASTContext *clang_type_system = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_type_system = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_type_system) return nullptr; clang_type_system->GetPDBParser()->GetDeclForSymbol(pdb_func); @@ -560,8 +560,8 @@ return nullptr; } - ClangASTContext *clang_type_system = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_type_system = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_type_system) return nullptr; PDBASTParser *pdb = clang_type_system->GetPDBParser(); @@ -597,8 +597,8 @@ return false; } - ClangASTContext *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_ast_ctx = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) return false; @@ -619,8 +619,8 @@ return CompilerDecl(); } - ClangASTContext *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_ast_ctx = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) return CompilerDecl(); @@ -649,8 +649,8 @@ return CompilerDeclContext(); } - ClangASTContext *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_ast_ctx = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) return CompilerDeclContext(); @@ -679,8 +679,8 @@ return CompilerDeclContext(); } - ClangASTContext *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_ast_ctx = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) return CompilerDeclContext(); @@ -708,8 +708,8 @@ return; } - ClangASTContext *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + TypeSystemClang *clang_ast_ctx = + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) return; @@ -1450,7 +1450,7 @@ } auto *clang_type_system = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_type_system) return; clang_type_system->Dump(s); @@ -1663,7 +1663,7 @@ } auto *clang_type_system = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_type_system) return nullptr; @@ -1685,7 +1685,7 @@ } auto *clang_type_system = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_type_system) return CompilerDeclContext(); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -15,7 +15,7 @@ #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -229,7 +229,7 @@ lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); - ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetItemInfoReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -15,7 +15,7 @@ #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -176,8 +176,8 @@ // Next make the runner function for our implementation utility function. Status error; - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); CompilerType get_pending_items_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); get_pending_items_caller = @@ -228,7 +228,7 @@ lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); - ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetPendingItemsReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -13,7 +13,7 @@ #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -190,8 +190,8 @@ } // Next make the runner function for our implementation utility function. - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); CompilerType get_queues_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Status error; @@ -231,7 +231,7 @@ lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); - ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetQueuesReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -16,7 +16,7 @@ #include "lldb/Expression/Expression.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -185,8 +185,8 @@ // Also make the FunctionCaller for this UtilityFunction: - ClangASTContext *clang_ast_context = - ClangASTContext::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = + TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); CompilerType get_thread_item_info_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); @@ -237,7 +237,7 @@ lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); - ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetThreadItemInfoReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Process.h" @@ -411,8 +411,8 @@ } #endif - ClangASTContext *ast_ctx = - ClangASTContext::GetScratch(m_process->GetTarget()); + TypeSystemClang *ast_ctx = + TypeSystemClang::GetScratch(m_process->GetTarget()); if (m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS) { CompilerType uint16 = ast_ctx->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 16); @@ -420,20 +420,20 @@ nullptr, lldb::eAccessPublic, "__lldb_dispatch_tsd_indexes_s", clang::TTK_Struct, lldb::eLanguageTypeC); - ClangASTContext::StartTagDeclarationDefinition(dispatch_tsd_indexes_s); - ClangASTContext::AddFieldToRecordType(dispatch_tsd_indexes_s, + TypeSystemClang::StartTagDeclarationDefinition(dispatch_tsd_indexes_s); + TypeSystemClang::AddFieldToRecordType(dispatch_tsd_indexes_s, "dti_version", uint16, lldb::eAccessPublic, 0); - ClangASTContext::AddFieldToRecordType(dispatch_tsd_indexes_s, + TypeSystemClang::AddFieldToRecordType(dispatch_tsd_indexes_s, "dti_queue_index", uint16, lldb::eAccessPublic, 0); - ClangASTContext::AddFieldToRecordType(dispatch_tsd_indexes_s, + TypeSystemClang::AddFieldToRecordType(dispatch_tsd_indexes_s, "dti_voucher_index", uint16, lldb::eAccessPublic, 0); - ClangASTContext::AddFieldToRecordType(dispatch_tsd_indexes_s, + TypeSystemClang::AddFieldToRecordType(dispatch_tsd_indexes_s, "dti_qos_class_index", uint16, lldb::eAccessPublic, 0); - ClangASTContext::CompleteTagDeclarationDefinition(dispatch_tsd_indexes_s); + TypeSystemClang::CompleteTagDeclarationDefinition(dispatch_tsd_indexes_s); ProcessStructReader struct_reader(m_process, m_dispatch_tsd_indexes_addr, dispatch_tsd_indexes_s); diff --git a/lldb/source/Symbol/CMakeLists.txt b/lldb/source/Symbol/CMakeLists.txt --- a/lldb/source/Symbol/CMakeLists.txt +++ b/lldb/source/Symbol/CMakeLists.txt @@ -7,7 +7,7 @@ add_lldb_library(lldbSymbol ArmUnwindInfo.cpp Block.cpp - ClangASTContext.cpp + TypeSystemClang.cpp ClangASTImporter.cpp ClangASTMetadata.cpp ClangExternalASTSourceCallbacks.cpp diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -8,7 +8,7 @@ #include "lldb/Symbol/ClangASTImporter.h" #include "lldb/Core/Module.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTMetadata.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Utility/LLDBAssert.h" @@ -25,12 +25,12 @@ using namespace lldb_private; using namespace clang; -CompilerType ClangASTImporter::CopyType(ClangASTContext &dst_ast, +CompilerType ClangASTImporter::CopyType(TypeSystemClang &dst_ast, const CompilerType &src_type) { clang::ASTContext &dst_clang_ast = dst_ast.getASTContext(); - ClangASTContext *src_ast = - llvm::dyn_cast_or_null(src_type.GetTypeSystem()); + TypeSystemClang *src_ast = + llvm::dyn_cast_or_null(src_type.GetTypeSystem()); if (!src_ast) return CompilerType(); @@ -248,7 +248,7 @@ Decl *original_decl = to_context_md->m_origins[decl].decl; // Complete the decl now. - ClangASTContext::GetCompleteDecl(m_src_ctx, original_decl); + TypeSystemClang::GetCompleteDecl(m_src_ctx, original_decl); if (auto *tag_decl = dyn_cast(decl)) { if (auto *original_tag_decl = dyn_cast(original_decl)) { if (original_tag_decl->isCompleteDefinition()) { @@ -290,12 +290,12 @@ }; } // namespace -CompilerType ClangASTImporter::DeportType(ClangASTContext &dst, +CompilerType ClangASTImporter::DeportType(TypeSystemClang &dst, const CompilerType &src_type) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - ClangASTContext *src_ctxt = - llvm::cast(src_type.GetTypeSystem()); + TypeSystemClang *src_ctxt = + llvm::cast(src_type.GetTypeSystem()); LLDB_LOG(log, " [ClangASTImporter] DeportType called on ({0}Type*){1:x} " @@ -503,11 +503,11 @@ return false; if (Import(compiler_type)) { - ClangASTContext::CompleteTagDeclarationDefinition(compiler_type); + TypeSystemClang::CompleteTagDeclarationDefinition(compiler_type); return true; } - ClangASTContext::SetHasExternalStorage(compiler_type.GetOpaqueQualType(), + TypeSystemClang::SetHasExternalStorage(compiler_type.GetOpaqueQualType(), false); return false; } @@ -578,7 +578,7 @@ if (!decl_origin.Valid()) return false; - if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl)) + if (!TypeSystemClang::GetCompleteDecl(decl_origin.ctx, decl_origin.decl)) return false; ImporterDelegateSP delegate_sp( @@ -596,7 +596,7 @@ clang::TagDecl *origin_decl) { clang::ASTContext *origin_ast_ctx = &origin_decl->getASTContext(); - if (!ClangASTContext::GetCompleteDecl(origin_ast_ctx, origin_decl)) + if (!TypeSystemClang::GetCompleteDecl(origin_ast_ctx, origin_decl)) return false; ImporterDelegateSP delegate_sp( @@ -621,7 +621,7 @@ if (!decl_origin.Valid()) return false; - if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl)) + if (!TypeSystemClang::GetCompleteDecl(decl_origin.ctx, decl_origin.decl)) return false; ImporterDelegateSP delegate_sp( @@ -736,10 +736,10 @@ DeclOrigin decl_origin = GetDeclOrigin(decl); if (decl_origin.Valid()) { - ClangASTContext *ast = ClangASTContext::GetASTContext(decl_origin.ctx); + TypeSystemClang *ast = TypeSystemClang::GetASTContext(decl_origin.ctx); return ast->GetMetadata(decl_origin.decl); } - ClangASTContext *ast = ClangASTContext::GetASTContext(&decl->getASTContext()); + TypeSystemClang *ast = TypeSystemClang::GetASTContext(&decl->getASTContext()); return ast->GetMetadata(decl); } diff --git a/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp b/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp --- a/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp +++ b/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Symbol/ClangExternalASTSourceCallbacks.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "clang/AST/Decl.h" diff --git a/lldb/source/Symbol/ClangUtil.cpp b/lldb/source/Symbol/ClangUtil.cpp --- a/lldb/source/Symbol/ClangUtil.cpp +++ b/lldb/source/Symbol/ClangUtil.cpp @@ -9,7 +9,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Symbol/ClangUtil.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" using namespace clang; using namespace lldb_private; @@ -19,7 +19,7 @@ if (!ct) return false; - if (llvm::dyn_cast_or_null(ct.GetTypeSystem()) == nullptr) + if (llvm::dyn_cast_or_null(ct.GetTypeSystem()) == nullptr) return false; if (!ct.GetOpaqueQualType()) diff --git a/lldb/source/Symbol/CxxModuleHandler.cpp b/lldb/source/Symbol/CxxModuleHandler.cpp --- a/lldb/source/Symbol/CxxModuleHandler.cpp +++ b/lldb/source/Symbol/CxxModuleHandler.cpp @@ -8,7 +8,7 @@ #include "lldb/Symbol/CxxModuleHandler.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Utility/Log.h" #include "clang/Sema/Lookup.h" #include "llvm/Support/Error.h" @@ -18,7 +18,7 @@ CxxModuleHandler::CxxModuleHandler(ASTImporter &importer, ASTContext *target) : m_importer(&importer), - m_sema(ClangASTContext::GetASTContext(target)->getSema()) { + m_sema(TypeSystemClang::GetASTContext(target)->getSema()) { std::initializer_list supported_names = { // containers diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -536,7 +536,7 @@ LLDB_LOG_ERROR( lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), std::move(err), - "Unable to construct void type from ClangASTContext"); + "Unable to construct void type from TypeSystemClang"); } else { CompilerType void_compiler_type = type_system_or_err->GetBasicTypeFromAST(eBasicTypeVoid); diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/TypeSystemClang.cpp rename from lldb/source/Symbol/ClangASTContext.cpp rename to lldb/source/Symbol/TypeSystemClang.cpp --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/TypeSystemClang.cpp @@ -1,4 +1,4 @@ -//===-- ClangASTContext.cpp -------------------------------------*- C++ -*-===// +//===-- TypeSystemClang.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "llvm/Support/FormatAdapters.h" #include "llvm/Support/FormatVariadic.h" @@ -90,7 +90,7 @@ #endif static inline bool -ClangASTContextSupportsLanguage(lldb::LanguageType language) { +TypeSystemClangSupportsLanguage(lldb::LanguageType language) { return language == eLanguageTypeUnknown || // Clang is the default type system lldb_private::Language::LanguageIsC(language) || lldb_private::Language::LanguageIsCPlusPlus(language) || @@ -300,7 +300,7 @@ return true; } -typedef lldb_private::ThreadSafeDenseMap +typedef lldb_private::ThreadSafeDenseMap ClangASTMap; static ClangASTMap &GetASTMap() { @@ -312,9 +312,9 @@ return *g_map_ptr; } -char ClangASTContext::ID; +char TypeSystemClang::ID; -bool ClangASTContext::IsOperator(llvm::StringRef name, +bool TypeSystemClang::IsOperator(llvm::StringRef name, clang::OverloadedOperatorKind &op_kind) { // All operators have to start with "operator". if (!name.consume_front("operator")) @@ -395,7 +395,7 @@ } clang::AccessSpecifier -ClangASTContext::ConvertAccessTypeToAccessSpecifier(AccessType access) { +TypeSystemClang::ConvertAccessTypeToAccessSpecifier(AccessType access) { switch (access) { default: break; @@ -499,17 +499,17 @@ Opts.NoInlineDefine = !Opt; } -ClangASTContext::ClangASTContext(llvm::StringRef name, +TypeSystemClang::TypeSystemClang(llvm::StringRef name, llvm::Triple target_triple) { m_display_name = name.str(); if (!target_triple.str().empty()) SetTargetTriple(target_triple.str()); // The caller didn't pass an ASTContext so create a new one for this - // ClangASTContext. + // TypeSystemClang. CreateASTContext(); } -ClangASTContext::ClangASTContext(llvm::StringRef name, +TypeSystemClang::TypeSystemClang(llvm::StringRef name, ASTContext &existing_ctxt) { m_display_name = name.str(); SetTargetTriple(existing_ctxt.getTargetInfo().getTriple().str()); @@ -519,22 +519,22 @@ } // Destructor -ClangASTContext::~ClangASTContext() { Finalize(); } +TypeSystemClang::~TypeSystemClang() { Finalize(); } -ConstString ClangASTContext::GetPluginNameStatic() { +ConstString TypeSystemClang::GetPluginNameStatic() { return ConstString("clang"); } -ConstString ClangASTContext::GetPluginName() { - return ClangASTContext::GetPluginNameStatic(); +ConstString TypeSystemClang::GetPluginName() { + return TypeSystemClang::GetPluginNameStatic(); } -uint32_t ClangASTContext::GetPluginVersion() { return 1; } +uint32_t TypeSystemClang::GetPluginVersion() { return 1; } -lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language, +lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language, lldb_private::Module *module, Target *target) { - if (!ClangASTContextSupportsLanguage(language)) + if (!TypeSystemClangSupportsLanguage(language)) return lldb::TypeSystemSP(); ArchSpec arch; if (module) @@ -563,13 +563,13 @@ if (module) { std::string ast_name = "ASTContext for '" + module->GetFileSpec().GetPath() + "'"; - return std::make_shared(ast_name, triple); + return std::make_shared(ast_name, triple); } else if (target && target->IsValid()) - return std::make_shared(*target, triple); + return std::make_shared(*target, triple); return lldb::TypeSystemSP(); } -LanguageSet ClangASTContext::GetSupportedLanguagesForTypes() { +LanguageSet TypeSystemClang::GetSupportedLanguagesForTypes() { LanguageSet languages; languages.Insert(lldb::eLanguageTypeC89); languages.Insert(lldb::eLanguageTypeC); @@ -585,7 +585,7 @@ return languages; } -LanguageSet ClangASTContext::GetSupportedLanguagesForExpressions() { +LanguageSet TypeSystemClang::GetSupportedLanguagesForExpressions() { LanguageSet languages; languages.Insert(lldb::eLanguageTypeC_plus_plus); languages.Insert(lldb::eLanguageTypeObjC_plus_plus); @@ -595,17 +595,17 @@ return languages; } -void ClangASTContext::Initialize() { +void TypeSystemClang::Initialize() { PluginManager::RegisterPlugin( GetPluginNameStatic(), "clang base AST context plug-in", CreateInstance, GetSupportedLanguagesForTypes(), GetSupportedLanguagesForExpressions()); } -void ClangASTContext::Terminate() { +void TypeSystemClang::Terminate() { PluginManager::UnregisterPlugin(CreateInstance); } -void ClangASTContext::Finalize() { +void TypeSystemClang::Finalize() { assert(m_ast_up); GetASTMap().Erase(m_ast_up.get()); if (!m_ast_owned) @@ -621,28 +621,28 @@ m_language_options_up.reset(); } -void ClangASTContext::setSema(Sema *s) { +void TypeSystemClang::setSema(Sema *s) { // Ensure that the new sema actually belongs to our ASTContext. assert(s == nullptr || &s->getASTContext() == m_ast_up.get()); m_sema = s; } -const char *ClangASTContext::GetTargetTriple() { +const char *TypeSystemClang::GetTargetTriple() { return m_target_triple.c_str(); } -void ClangASTContext::SetTargetTriple(llvm::StringRef target_triple) { +void TypeSystemClang::SetTargetTriple(llvm::StringRef target_triple) { m_target_triple = target_triple.str(); } -void ClangASTContext::SetExternalSource( +void TypeSystemClang::SetExternalSource( llvm::IntrusiveRefCntPtr &ast_source_up) { ASTContext &ast = getASTContext(); ast.setExternalSource(ast_source_up); ast.getTranslationUnitDecl()->setHasExternalLexicalStorage(true); } -ASTContext &ClangASTContext::getASTContext() { +ASTContext &TypeSystemClang::getASTContext() { assert(m_ast_up); return *m_ast_up; } @@ -671,7 +671,7 @@ Log *m_log; }; -void ClangASTContext::CreateASTContext() { +void TypeSystemClang::CreateASTContext() { assert(!m_ast_up); m_ast_owned = true; @@ -716,18 +716,18 @@ SetExternalSource(ast_source_up); } -ClangASTContext *ClangASTContext::GetASTContext(clang::ASTContext *ast) { - ClangASTContext *clang_ast = GetASTMap().Lookup(ast); +TypeSystemClang *TypeSystemClang::GetASTContext(clang::ASTContext *ast) { + TypeSystemClang *clang_ast = GetASTMap().Lookup(ast); return clang_ast; } -clang::MangleContext *ClangASTContext::getMangleContext() { +clang::MangleContext *TypeSystemClang::getMangleContext() { if (m_mangle_ctx_up == nullptr) m_mangle_ctx_up.reset(getASTContext().createMangleContext()); return m_mangle_ctx_up.get(); } -std::shared_ptr &ClangASTContext::getTargetOptions() { +std::shared_ptr &TypeSystemClang::getTargetOptions() { if (m_target_options_rp == nullptr && !m_target_triple.empty()) { m_target_options_rp = std::make_shared(); if (m_target_options_rp != nullptr) @@ -736,7 +736,7 @@ return m_target_options_rp; } -TargetInfo *ClangASTContext::getTargetInfo() { +TargetInfo *TypeSystemClang::getTargetInfo() { // target_triple should be something like "x86_64-apple-macosx" if (m_target_info_up == nullptr && !m_target_triple.empty()) m_target_info_up.reset(TargetInfo::CreateTargetInfo( @@ -753,7 +753,7 @@ } CompilerType -ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(Encoding encoding, +TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize(Encoding encoding, size_t bit_size) { ASTContext &ast = getASTContext(); switch (encoding) { @@ -814,7 +814,7 @@ } lldb::BasicType -ClangASTContext::GetBasicTypeEnumeration(ConstString name) { +TypeSystemClang::GetBasicTypeEnumeration(ConstString name) { if (name) { typedef UniqueCStringMap TypeNameToBasicTypeMap; static TypeNameToBasicTypeMap g_type_map; @@ -879,7 +879,7 @@ return eBasicTypeInvalid; } -uint32_t ClangASTContext::GetPointerByteSize() { +uint32_t TypeSystemClang::GetPointerByteSize() { if (m_pointer_byte_size == 0) if (auto size = GetBasicType(lldb::eBasicTypeVoid) .GetPointerType() @@ -888,7 +888,7 @@ return m_pointer_byte_size; } -CompilerType ClangASTContext::GetBasicType(lldb::BasicType basic_type) { +CompilerType TypeSystemClang::GetBasicType(lldb::BasicType basic_type) { clang::ASTContext &ast = getASTContext(); lldb::opaque_compiler_type_t clang_type = @@ -899,7 +899,7 @@ return CompilerType(); } -CompilerType ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize( +CompilerType TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize( llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size) { ASTContext &ast = getASTContext(); @@ -1112,7 +1112,7 @@ return CompilerType(); } -CompilerType ClangASTContext::GetCStringType(bool is_const) { +CompilerType TypeSystemClang::GetCStringType(bool is_const) { ASTContext &ast = getASTContext(); QualType char_type(ast.CharTy); @@ -1122,10 +1122,10 @@ return GetType(ast.getPointerType(char_type)); } -bool ClangASTContext::AreTypesSame(CompilerType type1, CompilerType type2, +bool TypeSystemClang::AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers) { - ClangASTContext *ast = - llvm::dyn_cast_or_null(type1.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast_or_null(type1.GetTypeSystem()); if (!ast || ast != type2.GetTypeSystem()) return false; @@ -1143,7 +1143,7 @@ return ast->getASTContext().hasSameType(type1_qual, type2_qual); } -CompilerType ClangASTContext::GetTypeForDecl(void *opaque_decl) { +CompilerType TypeSystemClang::GetTypeForDecl(void *opaque_decl) { if (!opaque_decl) return CompilerType(); @@ -1153,13 +1153,13 @@ return CompilerType(); } -CompilerDeclContext ClangASTContext::CreateDeclContext(DeclContext *ctx) { +CompilerDeclContext TypeSystemClang::CreateDeclContext(DeclContext *ctx) { // Check that the DeclContext actually belongs to this ASTContext. assert(&ctx->getParentASTContext() == &getASTContext()); return CompilerDeclContext(this, ctx); } -CompilerType ClangASTContext::GetTypeForDecl(clang::NamedDecl *decl) { +CompilerType TypeSystemClang::GetTypeForDecl(clang::NamedDecl *decl) { if (clang::ObjCInterfaceDecl *interface_decl = llvm::dyn_cast(decl)) return GetTypeForDecl(interface_decl); @@ -1168,17 +1168,17 @@ return CompilerType(); } -CompilerType ClangASTContext::GetTypeForDecl(TagDecl *decl) { +CompilerType TypeSystemClang::GetTypeForDecl(TagDecl *decl) { return GetType(getASTContext().getTagDeclType(decl)); } -CompilerType ClangASTContext::GetTypeForDecl(ObjCInterfaceDecl *decl) { +CompilerType TypeSystemClang::GetTypeForDecl(ObjCInterfaceDecl *decl) { return GetType(getASTContext().getObjCInterfaceType(decl)); } #pragma mark Structure, Unions, Classes -CompilerType ClangASTContext::CreateRecordType(DeclContext *decl_ctx, +CompilerType TypeSystemClang::CreateRecordType(DeclContext *decl_ctx, AccessType access_type, llvm::StringRef name, int kind, LanguageType language, @@ -1260,7 +1260,7 @@ static TemplateParameterList *CreateTemplateParameterList( ASTContext *ast, - const ClangASTContext::TemplateParameterInfos &template_param_infos, + const TypeSystemClang::TemplateParameterInfos &template_param_infos, llvm::SmallVector &template_param_decls) { const bool parameter_pack = false; const bool is_typename = false; @@ -1316,7 +1316,7 @@ return template_param_list; } -clang::FunctionTemplateDecl *ClangASTContext::CreateFunctionTemplateDecl( +clang::FunctionTemplateDecl *TypeSystemClang::CreateFunctionTemplateDecl( clang::DeclContext *decl_ctx, clang::FunctionDecl *func_decl, const char *name, const TemplateParameterInfos &template_param_infos) { // /// Create a function template node. @@ -1344,7 +1344,7 @@ return func_tmpl_decl; } -void ClangASTContext::CreateFunctionTemplateSpecializationInfo( +void TypeSystemClang::CreateFunctionTemplateSpecializationInfo( FunctionDecl *func_decl, clang::FunctionTemplateDecl *func_tmpl_decl, const TemplateParameterInfos &infos) { TemplateArgumentList *template_args_ptr = @@ -1354,7 +1354,7 @@ template_args_ptr, nullptr); } -ClassTemplateDecl *ClangASTContext::CreateClassTemplateDecl( +ClassTemplateDecl *TypeSystemClang::CreateClassTemplateDecl( DeclContext *decl_ctx, lldb::AccessType access_type, const char *class_name, int kind, const TemplateParameterInfos &template_param_infos) { ASTContext &ast = getASTContext(); @@ -1421,7 +1421,7 @@ } TemplateTemplateParmDecl * -ClangASTContext::CreateTemplateTemplateParmDecl(const char *template_name) { +TypeSystemClang::CreateTemplateTemplateParmDecl(const char *template_name) { ASTContext &ast = getASTContext(); auto *decl_ctx = ast.getTranslationUnitDecl(); @@ -1429,7 +1429,7 @@ IdentifierInfo &identifier_info = ast.Idents.get(template_name); llvm::SmallVector template_param_decls; - ClangASTContext::TemplateParameterInfos template_param_infos; + TypeSystemClang::TemplateParameterInfos template_param_infos; TemplateParameterList *template_param_list = CreateTemplateParameterList( &ast, template_param_infos, template_param_decls); @@ -1444,7 +1444,7 @@ } ClassTemplateSpecializationDecl * -ClangASTContext::CreateClassTemplateSpecializationDecl( +TypeSystemClang::CreateClassTemplateSpecializationDecl( DeclContext *decl_ctx, ClassTemplateDecl *class_template_decl, int kind, const TemplateParameterInfos &template_param_infos) { ASTContext &ast = getASTContext(); @@ -1468,7 +1468,7 @@ return class_template_specialization_decl; } -CompilerType ClangASTContext::CreateClassTemplateSpecializationType( +CompilerType TypeSystemClang::CreateClassTemplateSpecializationType( ClassTemplateSpecializationDecl *class_template_specialization_decl) { if (class_template_specialization_decl) { ASTContext &ast = getASTContext(); @@ -1496,7 +1496,7 @@ return false; } -bool ClangASTContext::CheckOverloadedOperatorKindParameterCount( +bool TypeSystemClang::CheckOverloadedOperatorKindParameterCount( bool is_method, clang::OverloadedOperatorKind op_kind, uint32_t num_params) { switch (op_kind) { @@ -1522,7 +1522,7 @@ } clang::AccessSpecifier -ClangASTContext::UnifyAccessSpecifiers(clang::AccessSpecifier lhs, +TypeSystemClang::UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs) { // Make the access equal to the stricter of the field and the nested field's // access @@ -1535,7 +1535,7 @@ return AS_public; } -bool ClangASTContext::FieldIsBitfield(FieldDecl *field, +bool TypeSystemClang::FieldIsBitfield(FieldDecl *field, uint32_t &bitfield_bit_size) { ASTContext &ast = getASTContext(); if (field == nullptr) @@ -1554,7 +1554,7 @@ return false; } -bool ClangASTContext::RecordHasFields(const RecordDecl *record_decl) { +bool TypeSystemClang::RecordHasFields(const RecordDecl *record_decl) { if (record_decl == nullptr) return false; @@ -1579,7 +1579,7 @@ #pragma mark Objective-C Classes -CompilerType ClangASTContext::CreateObjCClass(llvm::StringRef name, +CompilerType TypeSystemClang::CreateObjCClass(llvm::StringRef name, DeclContext *decl_ctx, bool isForwardDecl, bool isInternal, @@ -1602,11 +1602,11 @@ } static inline bool BaseSpecifierIsEmpty(const CXXBaseSpecifier *b) { - return !ClangASTContext::RecordHasFields(b->getType()->getAsCXXRecordDecl()); + return !TypeSystemClang::RecordHasFields(b->getType()->getAsCXXRecordDecl()); } uint32_t -ClangASTContext::GetNumBaseClasses(const CXXRecordDecl *cxx_record_decl, +TypeSystemClang::GetNumBaseClasses(const CXXRecordDecl *cxx_record_decl, bool omit_empty_base_classes) { uint32_t num_bases = 0; if (cxx_record_decl) { @@ -1630,7 +1630,7 @@ #pragma mark Namespace Declarations -NamespaceDecl *ClangASTContext::GetUniqueNamespaceDeclaration( +NamespaceDecl *TypeSystemClang::GetUniqueNamespaceDeclaration( const char *name, DeclContext *decl_ctx, bool is_inline) { NamespaceDecl *namespace_decl = nullptr; ASTContext &ast = getASTContext(); @@ -1691,7 +1691,7 @@ } clang::BlockDecl * -ClangASTContext::CreateBlockDeclaration(clang::DeclContext *ctx) { +TypeSystemClang::CreateBlockDeclaration(clang::DeclContext *ctx) { if (ctx != nullptr) { clang::BlockDecl *decl = clang::BlockDecl::Create(getASTContext(), ctx, clang::SourceLocation()); @@ -1718,7 +1718,7 @@ return nullptr; } -clang::UsingDirectiveDecl *ClangASTContext::CreateUsingDirectiveDeclaration( +clang::UsingDirectiveDecl *TypeSystemClang::CreateUsingDirectiveDeclaration( clang::DeclContext *decl_ctx, clang::NamespaceDecl *ns_decl) { if (decl_ctx != nullptr && ns_decl != nullptr) { auto *translation_unit = getASTContext().getTranslationUnitDecl(); @@ -1734,7 +1734,7 @@ } clang::UsingDecl * -ClangASTContext::CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, +TypeSystemClang::CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, clang::NamedDecl *target) { if (current_decl_ctx != nullptr && target != nullptr) { clang::UsingDecl *using_decl = clang::UsingDecl::Create( @@ -1750,7 +1750,7 @@ return nullptr; } -clang::VarDecl *ClangASTContext::CreateVariableDeclaration( +clang::VarDecl *TypeSystemClang::CreateVariableDeclaration( clang::DeclContext *decl_context, const char *name, clang::QualType type) { if (decl_context != nullptr) { clang::VarDecl *var_decl = clang::VarDecl::Create( @@ -1766,7 +1766,7 @@ } lldb::opaque_compiler_type_t -ClangASTContext::GetOpaqueCompilerType(clang::ASTContext *ast, +TypeSystemClang::GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type) { switch (basic_type) { case eBasicTypeVoid: @@ -1839,7 +1839,7 @@ #pragma mark Function Types clang::DeclarationName -ClangASTContext::GetDeclarationName(const char *name, +TypeSystemClang::GetDeclarationName(const char *name, const CompilerType &function_clang_type) { if (!name || !name[0]) return clang::DeclarationName(); @@ -1861,14 +1861,14 @@ const bool is_method = false; const unsigned int num_params = function_type->getNumParams(); - if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( + if (!TypeSystemClang::CheckOverloadedOperatorKindParameterCount( is_method, op_kind, num_params)) return clang::DeclarationName(); return getASTContext().DeclarationNames.getCXXOperatorName(op_kind); } -FunctionDecl *ClangASTContext::CreateFunctionDeclaration( +FunctionDecl *TypeSystemClang::CreateFunctionDeclaration( DeclContext *decl_ctx, const char *name, const CompilerType &function_clang_type, int storage, bool is_inline) { FunctionDecl *func_decl = nullptr; @@ -1897,7 +1897,7 @@ } CompilerType -ClangASTContext::CreateFunctionType(const CompilerType &result_type, +TypeSystemClang::CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc) { @@ -1935,7 +1935,7 @@ ClangUtil::GetQualType(result_type), qual_type_args, proto_info)); } -ParmVarDecl *ClangASTContext::CreateParameterDeclaration( +ParmVarDecl *TypeSystemClang::CreateParameterDeclaration( clang::DeclContext *decl_ctx, const char *name, const CompilerType ¶m_type, int storage, bool add_decl) { ASTContext &ast = getASTContext(); @@ -1950,7 +1950,7 @@ return decl; } -void ClangASTContext::SetFunctionParameters(FunctionDecl *function_decl, +void TypeSystemClang::SetFunctionParameters(FunctionDecl *function_decl, ParmVarDecl **params, unsigned num_params) { if (function_decl) @@ -1958,7 +1958,7 @@ } CompilerType -ClangASTContext::CreateBlockPointerType(const CompilerType &function_type) { +TypeSystemClang::CreateBlockPointerType(const CompilerType &function_type) { QualType block_type = m_ast_up->getBlockPointerType( clang::QualType::getFromOpaquePtr(function_type.GetOpaqueQualType())); @@ -1967,7 +1967,7 @@ #pragma mark Array Types -CompilerType ClangASTContext::CreateArrayType(const CompilerType &element_type, +CompilerType TypeSystemClang::CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector) { if (element_type.IsValid()) { @@ -1992,7 +1992,7 @@ return CompilerType(); } -CompilerType ClangASTContext::CreateStructForIdentifier( +CompilerType TypeSystemClang::CreateStructForIdentifier( ConstString type_name, const std::initializer_list> &type_fields, @@ -2017,7 +2017,7 @@ return type; } -CompilerType ClangASTContext::GetOrCreateStructForIdentifier( +CompilerType TypeSystemClang::GetOrCreateStructForIdentifier( ConstString type_name, const std::initializer_list> &type_fields, @@ -2032,7 +2032,7 @@ #pragma mark Enumeration Types CompilerType -ClangASTContext::CreateEnumerationType(const char *name, DeclContext *decl_ctx, +TypeSystemClang::CreateEnumerationType(const char *name, DeclContext *decl_ctx, const Declaration &decl, const CompilerType &integer_clang_type, bool is_scoped) { @@ -2064,7 +2064,7 @@ return CompilerType(); } -CompilerType ClangASTContext::GetIntTypeFromBitSize(size_t bit_size, +CompilerType TypeSystemClang::GetIntTypeFromBitSize(size_t bit_size, bool is_signed) { clang::ASTContext &ast = getASTContext(); @@ -2108,12 +2108,12 @@ return CompilerType(); } -CompilerType ClangASTContext::GetPointerSizedIntType(bool is_signed) { +CompilerType TypeSystemClang::GetPointerSizedIntType(bool is_signed) { return GetIntTypeFromBitSize( getASTContext().getTypeSize(getASTContext().VoidPtrTy), is_signed); } -void ClangASTContext::DumpDeclContextHiearchy(clang::DeclContext *decl_ctx) { +void TypeSystemClang::DumpDeclContextHiearchy(clang::DeclContext *decl_ctx) { if (decl_ctx) { DumpDeclContextHiearchy(decl_ctx->getParent()); @@ -2127,7 +2127,7 @@ } } -void ClangASTContext::DumpDeclHiearchy(clang::Decl *decl) { +void TypeSystemClang::DumpDeclHiearchy(clang::Decl *decl) { if (decl == nullptr) return; DumpDeclContextHiearchy(decl->getDeclContext()); @@ -2149,7 +2149,7 @@ } } -bool ClangASTContext::DeclsAreEquivalent(clang::Decl *lhs_decl, +bool TypeSystemClang::DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl) { if (lhs_decl && rhs_decl) { // Make sure the decl kinds match first @@ -2232,7 +2232,7 @@ } return false; } -bool ClangASTContext::GetCompleteDecl(clang::ASTContext *ast, +bool TypeSystemClang::GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl) { if (!decl) return false; @@ -2268,45 +2268,45 @@ } } -void ClangASTContext::SetMetadataAsUserID(const clang::Decl *decl, +void TypeSystemClang::SetMetadataAsUserID(const clang::Decl *decl, user_id_t user_id) { ClangASTMetadata meta_data; meta_data.SetUserID(user_id); SetMetadata(decl, meta_data); } -void ClangASTContext::SetMetadataAsUserID(const clang::Type *type, +void TypeSystemClang::SetMetadataAsUserID(const clang::Type *type, user_id_t user_id) { ClangASTMetadata meta_data; meta_data.SetUserID(user_id); SetMetadata(type, meta_data); } -void ClangASTContext::SetMetadata(const clang::Decl *object, +void TypeSystemClang::SetMetadata(const clang::Decl *object, ClangASTMetadata &metadata) { m_decl_metadata[object] = metadata; } -void ClangASTContext::SetMetadata(const clang::Type *object, +void TypeSystemClang::SetMetadata(const clang::Type *object, ClangASTMetadata &metadata) { m_type_metadata[object] = metadata; } -ClangASTMetadata *ClangASTContext::GetMetadata(const clang::Decl *object) { +ClangASTMetadata *TypeSystemClang::GetMetadata(const clang::Decl *object) { auto It = m_decl_metadata.find(object); if (It != m_decl_metadata.end()) return &It->second; return nullptr; } -ClangASTMetadata *ClangASTContext::GetMetadata(const clang::Type *object) { +ClangASTMetadata *TypeSystemClang::GetMetadata(const clang::Type *object) { auto It = m_type_metadata.find(object); if (It != m_type_metadata.end()) return &It->second; return nullptr; } -bool ClangASTContext::SetTagTypeKind(clang::QualType tag_qual_type, +bool TypeSystemClang::SetTagTypeKind(clang::QualType tag_qual_type, int kind) const { const clang::Type *clang_type = tag_qual_type.getTypePtr(); if (clang_type) { @@ -2323,7 +2323,7 @@ return false; } -bool ClangASTContext::SetDefaultAccessForRecordFields( +bool TypeSystemClang::SetDefaultAccessForRecordFields( clang::RecordDecl *record_decl, int default_accessibility, int *assigned_accessibilities, size_t num_assigned_accessibilities) { if (record_decl) { @@ -2343,7 +2343,7 @@ } clang::DeclContext * -ClangASTContext::GetDeclContextForType(const CompilerType &type) { +TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } @@ -2378,7 +2378,7 @@ } clang::DeclContext * -ClangASTContext::GetDeclContextForType(clang::QualType type) { +TypeSystemClang::GetDeclContextForType(clang::QualType type) { if (type.isNull()) return nullptr; @@ -2539,7 +2539,7 @@ // Tests -bool ClangASTContext::IsAggregateType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsAggregateType(lldb::opaque_compiler_type_t type) { clang::QualType qual_type(RemoveWrappingTypes(GetCanonicalQualType(type))); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -2560,7 +2560,7 @@ return false; } -bool ClangASTContext::IsAnonymousType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsAnonymousType(lldb::opaque_compiler_type_t type) { clang::QualType qual_type(RemoveWrappingTypes(GetCanonicalQualType(type))); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -2582,7 +2582,7 @@ return false; } -bool ClangASTContext::IsArrayType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type_ptr, uint64_t *size, bool *is_incomplete) { clang::QualType qual_type(RemoveWrappingTypes(GetCanonicalQualType(type))); @@ -2651,7 +2651,7 @@ return false; } -bool ClangASTContext::IsVectorType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) { clang::QualType qual_type(GetCanonicalQualType(type)); @@ -2686,7 +2686,7 @@ return false; } -bool ClangASTContext::IsRuntimeGeneratedType( +bool TypeSystemClang::IsRuntimeGeneratedType( lldb::opaque_compiler_type_t type) { clang::DeclContext *decl_ctx = GetDeclContextForType(GetQualType(type)); if (!decl_ctx) @@ -2704,21 +2704,21 @@ return (ast_metadata->GetISAPtr() != 0); } -bool ClangASTContext::IsCharType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsCharType(lldb::opaque_compiler_type_t type) { return GetQualType(type).getUnqualifiedType()->isCharType(); } -bool ClangASTContext::IsCompleteType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsCompleteType(lldb::opaque_compiler_type_t type) { const bool allow_completion = false; return GetCompleteQualType(&getASTContext(), GetQualType(type), allow_completion); } -bool ClangASTContext::IsConst(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsConst(lldb::opaque_compiler_type_t type) { return GetQualType(type).isConstQualified(); } -bool ClangASTContext::IsCStringType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) { CompilerType pointee_or_element_clang_type; length = 0; @@ -2743,7 +2743,7 @@ return false; } -bool ClangASTContext::IsFunctionType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr) { if (type) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); @@ -2779,7 +2779,7 @@ // Used to detect "Homogeneous Floating-point Aggregates" uint32_t -ClangASTContext::IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, +TypeSystemClang::IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) { if (!type) return 0; @@ -2860,7 +2860,7 @@ return 0; } -size_t ClangASTContext::GetNumberOfFunctionArguments( +size_t TypeSystemClang::GetNumberOfFunctionArguments( lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type(GetCanonicalQualType(type)); @@ -2873,7 +2873,7 @@ } CompilerType -ClangASTContext::GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) { if (type) { clang::QualType qual_type(GetQualType(type)); @@ -2887,7 +2887,7 @@ return CompilerType(); } -bool ClangASTContext::IsFunctionPointerType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsFunctionPointerType(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); @@ -2912,7 +2912,7 @@ return false; } -bool ClangASTContext::IsBlockPointerType( +bool TypeSystemClang::IsBlockPointerType( lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) { if (type) { @@ -2949,7 +2949,7 @@ return false; } -bool ClangASTContext::IsIntegerType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) { if (!type) return false; @@ -2968,7 +2968,7 @@ return false; } -bool ClangASTContext::IsEnumerationType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsEnumerationType(lldb::opaque_compiler_type_t type, bool &is_signed) { if (type) { const clang::EnumType *enum_type = llvm::dyn_cast( @@ -2984,7 +2984,7 @@ return false; } -bool ClangASTContext::IsPointerType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) { if (type) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); @@ -3036,7 +3036,7 @@ return false; } -bool ClangASTContext::IsPointerOrReferenceType( +bool TypeSystemClang::IsPointerOrReferenceType( lldb::opaque_compiler_type_t type, CompilerType *pointee_type) { if (type) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); @@ -3101,7 +3101,7 @@ return false; } -bool ClangASTContext::IsReferenceType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue) { if (type) { @@ -3137,7 +3137,7 @@ return false; } -bool ClangASTContext::IsFloatingPointType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) { if (type) { clang::QualType qual_type(GetCanonicalQualType(type)); @@ -3175,7 +3175,7 @@ return false; } -bool ClangASTContext::IsDefined(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsDefined(lldb::opaque_compiler_type_t type) { if (!type) return false; @@ -3201,7 +3201,7 @@ return true; } -bool ClangASTContext::IsObjCClassType(const CompilerType &type) { +bool TypeSystemClang::IsObjCClassType(const CompilerType &type) { if (ClangUtil::IsClangType(type)) { clang::QualType qual_type(ClangUtil::GetCanonicalQualType(type)); @@ -3214,13 +3214,13 @@ return false; } -bool ClangASTContext::IsObjCObjectOrInterfaceType(const CompilerType &type) { +bool TypeSystemClang::IsObjCObjectOrInterfaceType(const CompilerType &type) { if (ClangUtil::IsClangType(type)) return ClangUtil::GetCanonicalQualType(type)->isObjCObjectOrInterfaceType(); return false; } -bool ClangASTContext::IsClassType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsClassType(lldb::opaque_compiler_type_t type) { if (!type) return false; clang::QualType qual_type(GetCanonicalQualType(type)); @@ -3228,7 +3228,7 @@ return (type_class == clang::Type::Record); } -bool ClangASTContext::IsEnumType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsEnumType(lldb::opaque_compiler_type_t type) { if (!type) return false; clang::QualType qual_type(GetCanonicalQualType(type)); @@ -3236,7 +3236,7 @@ return (type_class == clang::Type::Enum); } -bool ClangASTContext::IsPolymorphicClass(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsPolymorphicClass(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type(GetCanonicalQualType(type)); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -3262,7 +3262,7 @@ return false; } -bool ClangASTContext::IsPossibleDynamicType(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *dynamic_pointee_type, bool check_cplusplus, bool check_objc) { @@ -3391,39 +3391,39 @@ return false; } -bool ClangASTContext::IsScalarType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsScalarType(lldb::opaque_compiler_type_t type) { if (!type) return false; return (GetTypeInfo(type, nullptr) & eTypeIsScalar) != 0; } -bool ClangASTContext::IsTypedefType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsTypedefType(lldb::opaque_compiler_type_t type) { if (!type) return false; return GetQualType(type)->getTypeClass() == clang::Type::Typedef; } -bool ClangASTContext::IsVoidType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsVoidType(lldb::opaque_compiler_type_t type) { if (!type) return false; return GetCanonicalQualType(type)->isVoidType(); } -bool ClangASTContext::CanPassInRegisters(const CompilerType &type) { +bool TypeSystemClang::CanPassInRegisters(const CompilerType &type) { if (auto *record_decl = - ClangASTContext::GetAsRecordDecl(type)) { + TypeSystemClang::GetAsRecordDecl(type)) { return record_decl->canPassInRegisters(); } return false; } -bool ClangASTContext::SupportsLanguage(lldb::LanguageType language) { - return ClangASTContextSupportsLanguage(language); +bool TypeSystemClang::SupportsLanguage(lldb::LanguageType language) { + return TypeSystemClangSupportsLanguage(language); } Optional -ClangASTContext::GetCXXClassName(const CompilerType &type) { +TypeSystemClang::GetCXXClassName(const CompilerType &type) { if (!type) return llvm::None; @@ -3438,7 +3438,7 @@ return std::string(cxx_record_decl->getIdentifier()->getNameStart()); } -bool ClangASTContext::IsCXXClassType(const CompilerType &type) { +bool TypeSystemClang::IsCXXClassType(const CompilerType &type) { if (!type) return false; @@ -3446,7 +3446,7 @@ return !qual_type.isNull() && qual_type->getAsCXXRecordDecl() != nullptr; } -bool ClangASTContext::IsBeingDefined(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::IsBeingDefined(lldb::opaque_compiler_type_t type) { if (!type) return false; clang::QualType qual_type(GetCanonicalQualType(type)); @@ -3456,7 +3456,7 @@ return false; } -bool ClangASTContext::IsObjCObjectPointerType(const CompilerType &type, +bool TypeSystemClang::IsObjCObjectPointerType(const CompilerType &type, CompilerType *class_type_ptr) { if (!ClangUtil::IsClangType(type)) return false; @@ -3486,7 +3486,7 @@ // Type Completion -bool ClangASTContext::GetCompleteType(lldb::opaque_compiler_type_t type) { +bool TypeSystemClang::GetCompleteType(lldb::opaque_compiler_type_t type) { if (!type) return false; const bool allow_completion = true; @@ -3494,7 +3494,7 @@ allow_completion); } -ConstString ClangASTContext::GetTypeName(lldb::opaque_compiler_type_t type) { +ConstString TypeSystemClang::GetTypeName(lldb::opaque_compiler_type_t type) { std::string type_name; if (type) { clang::PrintingPolicy printing_policy(getASTContext().getPrintingPolicy()); @@ -3513,7 +3513,7 @@ } uint32_t -ClangASTContext::GetTypeInfo(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_clang_type) { if (!type) return 0; @@ -3714,7 +3714,7 @@ } lldb::LanguageType -ClangASTContext::GetMinimumLanguage(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetMinimumLanguage(lldb::opaque_compiler_type_t type) { if (!type) return lldb::eLanguageTypeC; @@ -3798,7 +3798,7 @@ } lldb::TypeClass -ClangASTContext::GetTypeClass(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) { if (!type) return lldb::eTypeClassInvalid; @@ -3918,7 +3918,7 @@ return lldb::eTypeClassOther; } -unsigned ClangASTContext::GetTypeQualifiers(lldb::opaque_compiler_type_t type) { +unsigned TypeSystemClang::GetTypeQualifiers(lldb::opaque_compiler_type_t type) { if (type) return GetQualType(type).getQualifiers().getCVRQualifiers(); return 0; @@ -3927,7 +3927,7 @@ // Creating related types CompilerType -ClangASTContext::GetArrayElementType(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride) { if (type) { clang::QualType qual_type(GetQualType(type)); @@ -3950,7 +3950,7 @@ return CompilerType(); } -CompilerType ClangASTContext::GetArrayType(lldb::opaque_compiler_type_t type, +CompilerType TypeSystemClang::GetArrayType(lldb::opaque_compiler_type_t type, uint64_t size) { if (type) { clang::QualType qual_type(GetCanonicalQualType(type)); @@ -3968,7 +3968,7 @@ } CompilerType -ClangASTContext::GetCanonicalType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetCanonicalType(lldb::opaque_compiler_type_t type) { if (type) return GetType(GetCanonicalQualType(type)); return CompilerType(); @@ -3988,14 +3988,14 @@ } CompilerType -ClangASTContext::GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) { if (type) return GetType( GetFullyUnqualifiedType_Impl(&getASTContext(), GetQualType(type))); return CompilerType(); } -int ClangASTContext::GetFunctionArgumentCount( +int TypeSystemClang::GetFunctionArgumentCount( lldb::opaque_compiler_type_t type) { if (type) { const clang::FunctionProtoType *func = @@ -4006,7 +4006,7 @@ return -1; } -CompilerType ClangASTContext::GetFunctionArgumentTypeAtIndex( +CompilerType TypeSystemClang::GetFunctionArgumentTypeAtIndex( lldb::opaque_compiler_type_t type, size_t idx) { if (type) { const clang::FunctionProtoType *func = @@ -4021,7 +4021,7 @@ } CompilerType -ClangASTContext::GetFunctionReturnType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetFunctionReturnType(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type(GetQualType(type)); const clang::FunctionProtoType *func = @@ -4033,7 +4033,7 @@ } size_t -ClangASTContext::GetNumMemberFunctions(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetNumMemberFunctions(lldb::opaque_compiler_type_t type) { size_t num_functions = 0; if (type) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); @@ -4093,7 +4093,7 @@ } TypeMemberFunctionImpl -ClangASTContext::GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) { std::string name; MemberFunctionKind kind(MemberFunctionKind::eMemberFunctionKindUnknown); @@ -4210,25 +4210,25 @@ } CompilerType -ClangASTContext::GetNonReferenceType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetNonReferenceType(lldb::opaque_compiler_type_t type) { if (type) return GetType(GetQualType(type).getNonReferenceType()); return CompilerType(); } -CompilerType ClangASTContext::CreateTypedefType( +CompilerType TypeSystemClang::CreateTypedefType( const CompilerType &type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx) { if (type && typedef_name && typedef_name[0]) { - ClangASTContext *ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast(type.GetTypeSystem()); if (!ast) return CompilerType(); clang::ASTContext &clang_ast = ast->getASTContext(); clang::QualType qual_type(ClangUtil::GetQualType(type)); clang::DeclContext *decl_ctx = - ClangASTContext::DeclContextGetAsDeclContext(compiler_decl_ctx); + TypeSystemClang::DeclContextGetAsDeclContext(compiler_decl_ctx); if (decl_ctx == nullptr) decl_ctx = ast->getASTContext().getTranslationUnitDecl(); @@ -4248,7 +4248,7 @@ } CompilerType -ClangASTContext::GetPointeeType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetPointeeType(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type(GetQualType(type)); return GetType(qual_type.getTypePtr()->getPointeeType()); @@ -4257,7 +4257,7 @@ } CompilerType -ClangASTContext::GetPointerType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetPointerType(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type(GetQualType(type)); @@ -4275,7 +4275,7 @@ } CompilerType -ClangASTContext::GetLValueReferenceType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetLValueReferenceType(lldb::opaque_compiler_type_t type) { if (type) return GetType(getASTContext().getLValueReferenceType(GetQualType(type))); else @@ -4283,21 +4283,21 @@ } CompilerType -ClangASTContext::GetRValueReferenceType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetRValueReferenceType(lldb::opaque_compiler_type_t type) { if (type) return GetType(getASTContext().getRValueReferenceType(GetQualType(type))); else return CompilerType(); } -CompilerType ClangASTContext::GetAtomicType(lldb::opaque_compiler_type_t type) { +CompilerType TypeSystemClang::GetAtomicType(lldb::opaque_compiler_type_t type) { if (!type) return CompilerType(); return GetType(getASTContext().getAtomicType(GetQualType(type))); } CompilerType -ClangASTContext::AddConstModifier(lldb::opaque_compiler_type_t type) { +TypeSystemClang::AddConstModifier(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType result(GetQualType(type)); result.addConst(); @@ -4307,7 +4307,7 @@ } CompilerType -ClangASTContext::AddVolatileModifier(lldb::opaque_compiler_type_t type) { +TypeSystemClang::AddVolatileModifier(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType result(GetQualType(type)); result.addVolatile(); @@ -4317,7 +4317,7 @@ } CompilerType -ClangASTContext::AddRestrictModifier(lldb::opaque_compiler_type_t type) { +TypeSystemClang::AddRestrictModifier(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType result(GetQualType(type)); result.addRestrict(); @@ -4327,7 +4327,7 @@ } CompilerType -ClangASTContext::CreateTypedef(lldb::opaque_compiler_type_t type, +TypeSystemClang::CreateTypedef(lldb::opaque_compiler_type_t type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx) { if (type) { @@ -4335,7 +4335,7 @@ clang::QualType qual_type(GetQualType(type)); clang::DeclContext *decl_ctx = - ClangASTContext::DeclContextGetAsDeclContext(compiler_decl_ctx); + TypeSystemClang::DeclContextGetAsDeclContext(compiler_decl_ctx); if (decl_ctx == nullptr) decl_ctx = getASTContext().getTranslationUnitDecl(); @@ -4367,7 +4367,7 @@ } CompilerType -ClangASTContext::GetTypedefedType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetTypedefedType(lldb::opaque_compiler_type_t type) { if (type) { const clang::TypedefType *typedef_type = llvm::dyn_cast(GetQualType(type)); @@ -4379,13 +4379,13 @@ // Create related types using the current type's AST -CompilerType ClangASTContext::GetBasicTypeFromAST(lldb::BasicType basic_type) { - return ClangASTContext::GetBasicType(basic_type); +CompilerType TypeSystemClang::GetBasicTypeFromAST(lldb::BasicType basic_type) { + return TypeSystemClang::GetBasicType(basic_type); } // Exploring the type const llvm::fltSemantics & -ClangASTContext::GetFloatTypeSemantics(size_t byte_size) { +TypeSystemClang::GetFloatTypeSemantics(size_t byte_size) { clang::ASTContext &ast = getASTContext(); const size_t bit_size = byte_size * 8; if (bit_size == ast.getTypeSize(ast.FloatTy)) @@ -4400,7 +4400,7 @@ } Optional -ClangASTContext::GetBitSize(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) { if (GetCompleteType(type)) { clang::QualType qual_type(GetCanonicalQualType(type)); @@ -4464,14 +4464,14 @@ } llvm::Optional -ClangASTContext::GetTypeBitAlign(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) { if (GetCompleteType(type)) return getASTContext().getTypeAlign(GetQualType(type)); return {}; } -lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type, +lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) { if (!type) return lldb::eEncodingInvalid; @@ -4727,7 +4727,7 @@ return lldb::eEncodingInvalid; } -lldb::Format ClangASTContext::GetFormat(lldb::opaque_compiler_type_t type) { +lldb::Format TypeSystemClang::GetFormat(lldb::opaque_compiler_type_t type) { if (!type) return lldb::eFormatDefault; @@ -4884,7 +4884,7 @@ } static Optional -GetDynamicArrayInfo(ClangASTContext &ast, SymbolFile *sym_file, +GetDynamicArrayInfo(TypeSystemClang &ast, SymbolFile *sym_file, clang::QualType qual_type, const ExecutionContext *exe_ctx) { if (qual_type->isIncompleteArrayType()) @@ -4894,7 +4894,7 @@ return llvm::None; } -uint32_t ClangASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, +uint32_t TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx) { if (!type) @@ -4943,7 +4943,7 @@ ->getDecl()); // Skip empty base classes - if (!ClangASTContext::RecordHasFields(base_class_decl)) + if (!TypeSystemClang::RecordHasFields(base_class_decl)) continue; num_children++; @@ -5056,12 +5056,12 @@ return num_children; } -CompilerType ClangASTContext::GetBuiltinTypeByName(ConstString name) { +CompilerType TypeSystemClang::GetBuiltinTypeByName(ConstString name) { return GetBasicType(GetBasicTypeEnumeration(name)); } lldb::BasicType -ClangASTContext::GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) { if (type) { clang::QualType qual_type(GetQualType(type)); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -5133,7 +5133,7 @@ return eBasicTypeInvalid; } -void ClangASTContext::ForEachEnumerator( +void TypeSystemClang::ForEachEnumerator( lldb::opaque_compiler_type_t type, std::functiongetTypeClass(); @@ -5431,7 +5431,7 @@ } uint32_t -ClangASTContext::GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) { uint32_t count = 0; clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -5451,7 +5451,7 @@ return count; } -CompilerType ClangASTContext::GetDirectBaseClassAtIndex( +CompilerType TypeSystemClang::GetDirectBaseClassAtIndex( lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -5546,7 +5546,7 @@ return CompilerType(); } -CompilerType ClangASTContext::GetVirtualBaseClassAtIndex( +CompilerType TypeSystemClang::GetVirtualBaseClassAtIndex( lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) { clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type)); const clang::Type::TypeClass type_class = qual_type->getTypeClass(); @@ -5594,7 +5594,7 @@ // different result. For example, an "int *" has one child that is an integer, // but a function pointer doesn't have any children. Likewise if a Record type // claims it has no children, then there really is nothing to show. -uint32_t ClangASTContext::GetNumPointeeChildren(clang::QualType type) { +uint32_t TypeSystemClang::GetNumPointeeChildren(clang::QualType type) { if (type.isNull()) return 0; @@ -5727,7 +5727,7 @@ return 0; } -CompilerType ClangASTContext::GetChildCompilerTypeAtIndex( +CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex( lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, @@ -5797,7 +5797,7 @@ if (omit_empty_base_classes) { base_class_decl = llvm::cast( base_class->getType()->getAs()->getDecl()); - if (!ClangASTContext::RecordHasFields(base_class_decl)) + if (!TypeSystemClang::RecordHasFields(base_class_decl)) continue; } @@ -6209,7 +6209,7 @@ static uint32_t GetIndexForRecordChild(const clang::RecordDecl *record_decl, clang::NamedDecl *canonical_decl, bool omit_empty_base_classes) { - uint32_t child_idx = ClangASTContext::GetNumBaseClasses( + uint32_t child_idx = TypeSystemClang::GetNumBaseClasses( llvm::dyn_cast(record_decl), omit_empty_base_classes); @@ -6256,7 +6256,7 @@ // class C (since class B doesn't have any members it doesn't count) The second // index 1 is the child index for "m_b" within class A -size_t ClangASTContext::GetIndexOfChildMemberWithName( +size_t TypeSystemClang::GetIndexOfChildMemberWithName( lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes, std::vector &child_indexes) { if (type && name && name[0]) { @@ -6293,7 +6293,7 @@ } else if (field_name.equals(name_sref)) { // We have to add on the number of base classes to this index! child_indexes.push_back( - child_idx + ClangASTContext::GetNumBaseClasses( + child_idx + TypeSystemClang::GetNumBaseClasses( cxx_record_decl, omit_empty_base_classes)); return child_indexes.size(); } @@ -6451,7 +6451,7 @@ // clang::QualType pointee_type = // mem_ptr_type->getPointeeType(); // - // if (ClangASTContext::IsAggregateType + // if (TypeSystemClang::IsAggregateType // (pointee_type.getAsOpaquePtr())) // { // return GetIndexOfChildWithName (ast, @@ -6495,7 +6495,7 @@ // matches can include base class names. uint32_t -ClangASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) { if (type && name && name[0]) { @@ -6529,7 +6529,7 @@ ->getAs() ->getDecl()); if (omit_empty_base_classes && - !ClangASTContext::RecordHasFields(base_class_decl)) + !TypeSystemClang::RecordHasFields(base_class_decl)) continue; CompilerType base_class_clang_type = GetType(base_class->getType()); @@ -6632,7 +6632,7 @@ // clang::QualType pointee_type = // mem_ptr_type->getPointeeType(); // - // if (ClangASTContext::IsAggregateType + // if (TypeSystemClang::IsAggregateType // (pointee_type.getAsOpaquePtr())) // { // return GetIndexOfChildWithName (ast, @@ -6690,7 +6690,7 @@ } size_t -ClangASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) { if (!type) return 0; @@ -6719,7 +6719,7 @@ } const clang::ClassTemplateSpecializationDecl * -ClangASTContext::GetAsTemplateSpecialization( +TypeSystemClang::GetAsTemplateSpecialization( lldb::opaque_compiler_type_t type) { if (!type) return nullptr; @@ -6744,7 +6744,7 @@ } lldb::TemplateArgumentKind -ClangASTContext::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t arg_idx) { const clang::ClassTemplateSpecializationDecl *template_decl = GetAsTemplateSpecialization(type); @@ -6783,7 +6783,7 @@ } CompilerType -ClangASTContext::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx) { const clang::ClassTemplateSpecializationDecl *template_decl = GetAsTemplateSpecialization(type); @@ -6799,7 +6799,7 @@ } Optional -ClangASTContext::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, +TypeSystemClang::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx) { const clang::ClassTemplateSpecializationDecl *template_decl = GetAsTemplateSpecialization(type); @@ -6815,13 +6815,13 @@ {template_arg.getAsIntegral(), GetType(template_arg.getIntegralType())}}; } -CompilerType ClangASTContext::GetTypeForFormatters(void *type) { +CompilerType TypeSystemClang::GetTypeForFormatters(void *type) { if (type) return ClangUtil::RemoveFastQualifiers(CompilerType(this, type)); return CompilerType(); } -clang::EnumDecl *ClangASTContext::GetAsEnumDecl(const CompilerType &type) { +clang::EnumDecl *TypeSystemClang::GetAsEnumDecl(const CompilerType &type) { const clang::EnumType *enutype = llvm::dyn_cast(ClangUtil::GetCanonicalQualType(type)); if (enutype) @@ -6829,7 +6829,7 @@ return nullptr; } -clang::RecordDecl *ClangASTContext::GetAsRecordDecl(const CompilerType &type) { +clang::RecordDecl *TypeSystemClang::GetAsRecordDecl(const CompilerType &type) { const clang::RecordType *record_type = llvm::dyn_cast(ClangUtil::GetCanonicalQualType(type)); if (record_type) @@ -6837,12 +6837,12 @@ return nullptr; } -clang::TagDecl *ClangASTContext::GetAsTagDecl(const CompilerType &type) { +clang::TagDecl *TypeSystemClang::GetAsTagDecl(const CompilerType &type) { return ClangUtil::GetAsTagDecl(type); } clang::TypedefNameDecl * -ClangASTContext::GetAsTypedefDecl(const CompilerType &type) { +TypeSystemClang::GetAsTypedefDecl(const CompilerType &type) { const clang::TypedefType *typedef_type = llvm::dyn_cast(ClangUtil::GetQualType(type)); if (typedef_type) @@ -6851,12 +6851,12 @@ } clang::CXXRecordDecl * -ClangASTContext::GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type) { return GetCanonicalQualType(type)->getAsCXXRecordDecl(); } clang::ObjCInterfaceDecl * -ClangASTContext::GetAsObjCInterfaceDecl(const CompilerType &type) { +TypeSystemClang::GetAsObjCInterfaceDecl(const CompilerType &type) { const clang::ObjCObjectType *objc_class_type = llvm::dyn_cast( ClangUtil::GetCanonicalQualType(type)); @@ -6865,14 +6865,14 @@ return nullptr; } -clang::FieldDecl *ClangASTContext::AddFieldToRecordType( +clang::FieldDecl *TypeSystemClang::AddFieldToRecordType( const CompilerType &type, llvm::StringRef name, const CompilerType &field_clang_type, AccessType access, uint32_t bitfield_bit_size) { if (!type.IsValid() || !field_clang_type.IsValid()) return nullptr; - ClangASTContext *ast = - llvm::dyn_cast_or_null(type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast_or_null(type.GetTypeSystem()); if (!ast) return nullptr; clang::ASTContext &clang_ast = ast->getASTContext(); @@ -6919,7 +6919,7 @@ if (field) { field->setAccess( - ClangASTContext::ConvertAccessTypeToAccessSpecifier(access)); + TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access)); record_decl->addDecl(field); @@ -6957,11 +6957,11 @@ return field; } -void ClangASTContext::BuildIndirectFields(const CompilerType &type) { +void TypeSystemClang::BuildIndirectFields(const CompilerType &type) { if (!type) return; - ClangASTContext *ast = llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *ast = llvm::dyn_cast(type.GetTypeSystem()); if (!ast) return; @@ -7010,7 +7010,7 @@ indirect_field->setImplicit(); - indirect_field->setAccess(ClangASTContext::UnifyAccessSpecifiers( + indirect_field->setAccess(TypeSystemClang::UnifyAccessSpecifiers( field_pos->getAccess(), nested_field_decl->getAccess())); indirect_fields.push_back(indirect_field); @@ -7040,7 +7040,7 @@ indirect_field->setImplicit(); - indirect_field->setAccess(ClangASTContext::UnifyAccessSpecifiers( + indirect_field->setAccess(TypeSystemClang::UnifyAccessSpecifiers( field_pos->getAccess(), nested_indirect_field_decl->getAccess())); indirect_fields.push_back(indirect_field); @@ -7063,10 +7063,10 @@ } } -void ClangASTContext::SetIsPacked(const CompilerType &type) { +void TypeSystemClang::SetIsPacked(const CompilerType &type) { if (type) { - ClangASTContext *ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast(type.GetTypeSystem()); if (ast) { clang::RecordDecl *record_decl = GetAsRecordDecl(type); @@ -7079,13 +7079,13 @@ } } -clang::VarDecl *ClangASTContext::AddVariableToRecordType( +clang::VarDecl *TypeSystemClang::AddVariableToRecordType( const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, AccessType access) { if (!type.IsValid() || !var_type.IsValid()) return nullptr; - ClangASTContext *ast = llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *ast = llvm::dyn_cast(type.GetTypeSystem()); if (!ast) return nullptr; @@ -7111,7 +7111,7 @@ return nullptr; var_decl->setAccess( - ClangASTContext::ConvertAccessTypeToAccessSpecifier(access)); + TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access)); record_decl->addDecl(var_decl); #ifdef LLDB_CONFIGURATION_DEBUG @@ -7121,7 +7121,7 @@ return var_decl; } -clang::CXXMethodDecl *ClangASTContext::AddMethodToCXXRecordType( +clang::CXXMethodDecl *TypeSystemClang::AddMethodToCXXRecordType( lldb::opaque_compiler_type_t type, llvm::StringRef name, const char *mangled_name, const CompilerType &method_clang_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, @@ -7199,7 +7199,7 @@ // create a method and add it to the class, clang will assert and // crash, so we need to make sure things are acceptable. const bool is_method = true; - if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( + if (!TypeSystemClang::CheckOverloadedOperatorKindParameterCount( is_method, op_kind, num_params)) return nullptr; cxx_method_decl = clang::CXXMethodDecl::Create( @@ -7236,7 +7236,7 @@ } clang::AccessSpecifier access_specifier = - ClangASTContext::ConvertAccessTypeToAccessSpecifier(access); + TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access); cxx_method_decl->setAccess(access_specifier); cxx_method_decl->setVirtualAsWritten(is_virtual); @@ -7303,7 +7303,7 @@ return cxx_method_decl; } -void ClangASTContext::AddMethodOverridesForCXXRecordType( +void TypeSystemClang::AddMethodOverridesForCXXRecordType( lldb::opaque_compiler_type_t type) { if (auto *record = GetAsCXXRecordDecl(type)) for (auto *method : record->methods()) @@ -7313,7 +7313,7 @@ #pragma mark C++ Base Classes std::unique_ptr -ClangASTContext::CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, +TypeSystemClang::CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, AccessType access, bool is_virtual, bool base_of_class) { if (!type) @@ -7321,12 +7321,12 @@ return std::make_unique( clang::SourceRange(), is_virtual, base_of_class, - ClangASTContext::ConvertAccessTypeToAccessSpecifier(access), + TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access), getASTContext().getTrivialTypeSourceInfo(GetQualType(type)), clang::SourceLocation()); } -bool ClangASTContext::TransferBaseClasses( +bool TypeSystemClang::TransferBaseClasses( lldb::opaque_compiler_type_t type, std::vector> bases) { if (!type) @@ -7345,10 +7345,10 @@ return true; } -bool ClangASTContext::SetObjCSuperClass( +bool TypeSystemClang::SetObjCSuperClass( const CompilerType &type, const CompilerType &superclass_clang_type) { - ClangASTContext *ast = - llvm::dyn_cast_or_null(type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast_or_null(type.GetTypeSystem()); if (!ast) return false; clang::ASTContext &clang_ast = ast->getASTContext(); @@ -7368,7 +7368,7 @@ return false; } -bool ClangASTContext::AddObjCClassProperty( +bool TypeSystemClang::AddObjCClassProperty( const CompilerType &type, const char *property_name, const CompilerType &property_clang_type, clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, const char *property_getter_name, @@ -7376,7 +7376,7 @@ if (!type || !property_clang_type.IsValid() || property_name == nullptr || property_name[0] == '\0') return false; - ClangASTContext *ast = llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *ast = llvm::dyn_cast(type.GetTypeSystem()); if (!ast) return false; clang::ASTContext &clang_ast = ast->getASTContext(); @@ -7557,7 +7557,7 @@ return true; } -bool ClangASTContext::IsObjCClassTypeAndHasIVars(const CompilerType &type, +bool TypeSystemClang::IsObjCClassTypeAndHasIVars(const CompilerType &type, bool check_superclass) { clang::ObjCInterfaceDecl *class_interface_decl = GetAsObjCInterfaceDecl(type); if (class_interface_decl) @@ -7565,7 +7565,7 @@ return false; } -clang::ObjCMethodDecl *ClangASTContext::AddMethodToObjCObjectType( +clang::ObjCMethodDecl *TypeSystemClang::AddMethodToObjCObjectType( const CompilerType &type, const char *name, // the full symbol name as seen in the symbol table // (lldb::opaque_compiler_type_t type, "-[NString @@ -7579,8 +7579,8 @@ if (class_interface_decl == nullptr) return nullptr; - ClangASTContext *lldb_ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *lldb_ast = + llvm::dyn_cast(type.GetTypeSystem()); if (lldb_ast == nullptr) return nullptr; clang::ASTContext &ast = lldb_ast->getASTContext(); @@ -7697,7 +7697,7 @@ return objc_method_decl; } -bool ClangASTContext::SetHasExternalStorage(lldb::opaque_compiler_type_t type, +bool TypeSystemClang::SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern) { if (!type) return false; @@ -7750,7 +7750,7 @@ #pragma mark TagDecl -bool ClangASTContext::StartTagDeclarationDefinition(const CompilerType &type) { +bool TypeSystemClang::StartTagDeclarationDefinition(const CompilerType &type) { clang::QualType qual_type(ClangUtil::GetQualType(type)); if (!qual_type.isNull()) { const clang::TagType *tag_type = qual_type->getAs(); @@ -7775,14 +7775,14 @@ return false; } -bool ClangASTContext::CompleteTagDeclarationDefinition( +bool TypeSystemClang::CompleteTagDeclarationDefinition( const CompilerType &type) { clang::QualType qual_type(ClangUtil::GetQualType(type)); if (qual_type.isNull()) return false; // Make sure we use the same methodology as - // ClangASTContext::StartTagDeclarationDefinition() as to how we start/end + // TypeSystemClang::StartTagDeclarationDefinition() as to how we start/end // the definition. const clang::TagType *tag_type = qual_type->getAs(); if (tag_type) { @@ -7820,8 +7820,8 @@ if (enum_decl->isCompleteDefinition()) return true; - ClangASTContext *lldb_ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *lldb_ast = + llvm::dyn_cast(type.GetTypeSystem()); if (lldb_ast == nullptr) return false; clang::ASTContext &ast = lldb_ast->getASTContext(); @@ -7852,7 +7852,7 @@ return true; } -clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType( +clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType( const CompilerType &enum_type, const Declaration &decl, const char *name, const llvm::APSInt &value) { @@ -7897,7 +7897,7 @@ return enumerator_decl; } -clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType( +clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType( const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size) { CompilerType underlying_type = @@ -7912,7 +7912,7 @@ } CompilerType -ClangASTContext::GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) { clang::QualType enum_qual_type(GetCanonicalQualType(type)); const clang::Type *clang_type = enum_qual_type.getTypePtr(); if (clang_type) { @@ -7928,12 +7928,12 @@ } CompilerType -ClangASTContext::CreateMemberPointerType(const CompilerType &type, +TypeSystemClang::CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type) { if (type && pointee_type.IsValid() && type.GetTypeSystem() == pointee_type.GetTypeSystem()) { - ClangASTContext *ast = - llvm::dyn_cast(type.GetTypeSystem()); + TypeSystemClang *ast = + llvm::dyn_cast(type.GetTypeSystem()); if (!ast) return CompilerType(); return ast->GetType(ast->getASTContext().getMemberPointerType( @@ -7948,7 +7948,7 @@ #ifndef NDEBUG LLVM_DUMP_METHOD void -ClangASTContext::dump(lldb::opaque_compiler_type_t type) const { +TypeSystemClang::dump(lldb::opaque_compiler_type_t type) const { if (!type) return; clang::QualType qual_type(GetQualType(type)); @@ -7956,12 +7956,12 @@ } #endif -void ClangASTContext::Dump(Stream &s) { +void TypeSystemClang::Dump(Stream &s) { Decl *tu = Decl::castFromDeclContext(GetTranslationUnitDecl()); tu->dump(s.AsRawOstream()); } -void ClangASTContext::DumpFromSymbolFile(Stream &s, +void TypeSystemClang::DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name) { SymbolFile *symfile = GetSymbolFile(); @@ -8001,7 +8001,7 @@ } } -void ClangASTContext::DumpValue( +void TypeSystemClang::DumpValue( lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format, const lldb_private::DataExtractor &data, lldb::offset_t data_byte_offset, size_t data_byte_size, @@ -8038,7 +8038,7 @@ base_class->getType()->getAs()->getDecl()); // Skip empty base classes - if (!verbose && !ClangASTContext::RecordHasFields(base_class_decl)) + if (!verbose && !TypeSystemClang::RecordHasFields(base_class_decl)) continue; if (base_class->isVirtual()) @@ -8455,7 +8455,7 @@ return true; } -bool ClangASTContext::DumpTypeValue( +bool TypeSystemClang::DumpTypeValue( lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format, const lldb_private::DataExtractor &data, lldb::offset_t byte_offset, size_t byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, @@ -8578,7 +8578,7 @@ return false; } -void ClangASTContext::DumpSummary(lldb::opaque_compiler_type_t type, +void TypeSystemClang::DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, const lldb_private::DataExtractor &data, lldb::offset_t data_byte_offset, @@ -8623,7 +8623,7 @@ } } -void ClangASTContext::DumpTypeDescription(lldb::opaque_compiler_type_t type) { +void TypeSystemClang::DumpTypeDescription(lldb::opaque_compiler_type_t type) { StreamFile s(stdout, false); DumpTypeDescription(type, &s); @@ -8635,7 +8635,7 @@ } } -void ClangASTContext::DumpTypeDescription(lldb::opaque_compiler_type_t type, +void TypeSystemClang::DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream *s) { if (type) { clang::QualType qual_type = @@ -8715,7 +8715,7 @@ } } -void ClangASTContext::DumpTypeName(const CompilerType &type) { +void TypeSystemClang::DumpTypeName(const CompilerType &type) { if (ClangUtil::IsClangType(type)) { clang::QualType qual_type( ClangUtil::GetCanonicalQualType(ClangUtil::RemoveFastQualifiers(type))); @@ -8781,16 +8781,16 @@ llvm::cast(qual_type)->desugar().getAsOpaquePtr())); default: - printf("ClangASTContext::DumpTypeName() type_class = %u", type_class); + printf("TypeSystemClang::DumpTypeName() type_class = %u", type_class); break; } } } -clang::ClassTemplateDecl *ClangASTContext::ParseClassTemplateDecl( +clang::ClassTemplateDecl *TypeSystemClang::ParseClassTemplateDecl( clang::DeclContext *decl_ctx, lldb::AccessType access_type, const char *parent_name, int tag_decl_kind, - const ClangASTContext::TemplateParameterInfos &template_param_infos) { + const TypeSystemClang::TemplateParameterInfos &template_param_infos) { if (template_param_infos.IsValid()) { std::string template_basename(parent_name); template_basename.erase(template_basename.find('<')); @@ -8802,7 +8802,7 @@ return nullptr; } -void ClangASTContext::CompleteTagDecl(clang::TagDecl *decl) { +void TypeSystemClang::CompleteTagDecl(clang::TagDecl *decl) { SymbolFile *sym_file = GetSymbolFile(); if (sym_file) { CompilerType clang_type = GetTypeForDecl(decl); @@ -8811,7 +8811,7 @@ } } -void ClangASTContext::CompleteObjCInterfaceDecl( +void TypeSystemClang::CompleteObjCInterfaceDecl( clang::ObjCInterfaceDecl *decl) { SymbolFile *sym_file = GetSymbolFile(); if (sym_file) { @@ -8821,19 +8821,19 @@ } } -DWARFASTParser *ClangASTContext::GetDWARFParser() { +DWARFASTParser *TypeSystemClang::GetDWARFParser() { if (!m_dwarf_ast_parser_up) m_dwarf_ast_parser_up.reset(new DWARFASTParserClang(*this)); return m_dwarf_ast_parser_up.get(); } -PDBASTParser *ClangASTContext::GetPDBParser() { +PDBASTParser *TypeSystemClang::GetPDBParser() { if (!m_pdb_ast_parser_up) m_pdb_ast_parser_up.reset(new PDBASTParser(*this)); return m_pdb_ast_parser_up.get(); } -bool ClangASTContext::LayoutRecordType( +bool TypeSystemClang::LayoutRecordType( const clang::RecordDecl *record_decl, uint64_t &bit_size, uint64_t &alignment, llvm::DenseMap &field_offsets, @@ -8855,7 +8855,7 @@ // CompilerDecl override functions -ConstString ClangASTContext::DeclGetName(void *opaque_decl) { +ConstString TypeSystemClang::DeclGetName(void *opaque_decl) { if (opaque_decl) { clang::NamedDecl *nd = llvm::dyn_cast((clang::Decl *)opaque_decl); @@ -8865,7 +8865,7 @@ return ConstString(); } -ConstString ClangASTContext::DeclGetMangledName(void *opaque_decl) { +ConstString TypeSystemClang::DeclGetMangledName(void *opaque_decl) { if (opaque_decl) { clang::NamedDecl *nd = llvm::dyn_cast((clang::Decl *)opaque_decl); @@ -8891,13 +8891,13 @@ return ConstString(); } -CompilerDeclContext ClangASTContext::DeclGetDeclContext(void *opaque_decl) { +CompilerDeclContext TypeSystemClang::DeclGetDeclContext(void *opaque_decl) { if (opaque_decl) return CreateDeclContext(((clang::Decl *)opaque_decl)->getDeclContext()); return CompilerDeclContext(); } -CompilerType ClangASTContext::DeclGetFunctionReturnType(void *opaque_decl) { +CompilerType TypeSystemClang::DeclGetFunctionReturnType(void *opaque_decl) { if (clang::FunctionDecl *func_decl = llvm::dyn_cast((clang::Decl *)opaque_decl)) return GetType(func_decl->getReturnType()); @@ -8908,7 +8908,7 @@ return CompilerType(); } -size_t ClangASTContext::DeclGetFunctionNumArguments(void *opaque_decl) { +size_t TypeSystemClang::DeclGetFunctionNumArguments(void *opaque_decl) { if (clang::FunctionDecl *func_decl = llvm::dyn_cast((clang::Decl *)opaque_decl)) return func_decl->param_size(); @@ -8919,7 +8919,7 @@ return 0; } -CompilerType ClangASTContext::DeclGetFunctionArgumentType(void *opaque_decl, +CompilerType TypeSystemClang::DeclGetFunctionArgumentType(void *opaque_decl, size_t idx) { if (clang::FunctionDecl *func_decl = llvm::dyn_cast((clang::Decl *)opaque_decl)) { @@ -8939,7 +8939,7 @@ // CompilerDeclContext functions -std::vector ClangASTContext::DeclContextFindDeclByName( +std::vector TypeSystemClang::DeclContextFindDeclByName( void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) { std::vector found_decls; if (opaque_decl_ctx) { @@ -9036,7 +9036,7 @@ // below the global scope. More work needs to be done to recognise that, if // the decl we're trying to look up is static, we should compare its source // file with that of the current scope and return a lower number for it. -uint32_t ClangASTContext::CountDeclLevels(clang::DeclContext *frame_decl_ctx, +uint32_t TypeSystemClang::CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name, CompilerType *child_type) { @@ -9118,7 +9118,7 @@ return LLDB_INVALID_DECL_LEVEL; } -ConstString ClangASTContext::DeclContextGetName(void *opaque_decl_ctx) { +ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) { if (opaque_decl_ctx) { clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx); @@ -9129,7 +9129,7 @@ } ConstString -ClangASTContext::DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) { +TypeSystemClang::DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) { if (opaque_decl_ctx) { clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx); @@ -9140,7 +9140,7 @@ return ConstString(); } -bool ClangASTContext::DeclContextIsClassMethod( +bool TypeSystemClang::DeclContextIsClassMethod( void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr, ConstString *language_object_name_ptr) { if (opaque_decl_ctx) { @@ -9180,7 +9180,7 @@ return false; } -bool ClangASTContext::DeclContextIsContainedInLookup( +bool TypeSystemClang::DeclContextIsContainedInLookup( void *opaque_decl_ctx, void *other_opaque_decl_ctx) { auto *decl_ctx = (clang::DeclContext *)opaque_decl_ctx; auto *other = (clang::DeclContext *)other_opaque_decl_ctx; @@ -9198,18 +9198,18 @@ } static bool IsClangDeclContext(const CompilerDeclContext &dc) { - return dc.IsValid() && isa(dc.GetTypeSystem()); + return dc.IsValid() && isa(dc.GetTypeSystem()); } clang::DeclContext * -ClangASTContext::DeclContextGetAsDeclContext(const CompilerDeclContext &dc) { +TypeSystemClang::DeclContextGetAsDeclContext(const CompilerDeclContext &dc) { if (IsClangDeclContext(dc)) return (clang::DeclContext *)dc.GetOpaqueDeclContext(); return nullptr; } ObjCMethodDecl * -ClangASTContext::DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc) { +TypeSystemClang::DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc) { if (IsClangDeclContext(dc)) return llvm::dyn_cast( (clang::DeclContext *)dc.GetOpaqueDeclContext()); @@ -9217,7 +9217,7 @@ } CXXMethodDecl * -ClangASTContext::DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc) { +TypeSystemClang::DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc) { if (IsClangDeclContext(dc)) return llvm::dyn_cast( (clang::DeclContext *)dc.GetOpaqueDeclContext()); @@ -9225,7 +9225,7 @@ } clang::FunctionDecl * -ClangASTContext::DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc) { +TypeSystemClang::DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc) { if (IsClangDeclContext(dc)) return llvm::dyn_cast( (clang::DeclContext *)dc.GetOpaqueDeclContext()); @@ -9233,7 +9233,7 @@ } clang::NamespaceDecl * -ClangASTContext::DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc) { +TypeSystemClang::DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc) { if (IsClangDeclContext(dc)) return llvm::dyn_cast( (clang::DeclContext *)dc.GetOpaqueDeclContext()); @@ -9241,24 +9241,24 @@ } ClangASTMetadata * -ClangASTContext::DeclContextGetMetaData(const CompilerDeclContext &dc, +TypeSystemClang::DeclContextGetMetaData(const CompilerDeclContext &dc, const Decl *object) { - ClangASTContext *ast = llvm::cast(dc.GetTypeSystem()); + TypeSystemClang *ast = llvm::cast(dc.GetTypeSystem()); return ast->GetMetadata(object); } clang::ASTContext * -ClangASTContext::DeclContextGetClangASTContext(const CompilerDeclContext &dc) { - ClangASTContext *ast = - llvm::dyn_cast_or_null(dc.GetTypeSystem()); +TypeSystemClang::DeclContextGetTypeSystemClang(const CompilerDeclContext &dc) { + TypeSystemClang *ast = + llvm::dyn_cast_or_null(dc.GetTypeSystem()); if (ast) return &ast->getASTContext(); return nullptr; } -ClangASTContextForExpressions::ClangASTContextForExpressions( +TypeSystemClangForExpressions::TypeSystemClangForExpressions( Target &target, llvm::Triple triple) - : ClangASTContext("scratch ASTContext", triple), + : TypeSystemClang("scratch ASTContext", triple), m_target_wp(target.shared_from_this()), m_persistent_variables(new ClangPersistentVariables) { m_scratch_ast_source_up.reset(new ClangASTSource( @@ -9269,12 +9269,12 @@ SetExternalSource(proxy_ast_source); } -void ClangASTContextForExpressions::Finalize() { - ClangASTContext::Finalize(); +void TypeSystemClangForExpressions::Finalize() { + TypeSystemClang::Finalize(); m_scratch_ast_source_up.reset(); } -UserExpression *ClangASTContextForExpressions::GetUserExpression( +UserExpression *TypeSystemClangForExpressions::GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, @@ -9287,7 +9287,7 @@ desired_type, options, ctx_obj); } -FunctionCaller *ClangASTContextForExpressions::GetFunctionCaller( +FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller( const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name) { TargetSP target_sp = m_target_wp.lock(); @@ -9303,7 +9303,7 @@ } UtilityFunction * -ClangASTContextForExpressions::GetUtilityFunction(const char *text, +TypeSystemClangForExpressions::GetUtilityFunction(const char *text, const char *name) { TargetSP target_sp = m_target_wp.lock(); if (!target_sp) @@ -9313,6 +9313,6 @@ } PersistentExpressionState * -ClangASTContextForExpressions::GetPersistentExpressionState() { +TypeSystemClangForExpressions::GetPersistentExpressionState() { return m_persistent_variables.get(); } diff --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp --- a/lldb/tools/lldb-test/SystemInitializerTest.cpp +++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/Host.h" #include "lldb/Initialization/SystemInitializerCommon.h" #include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Utility/Timer.h" #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h" @@ -176,7 +176,7 @@ llvm::InitializeAllTargetMCs(); llvm::InitializeAllDisassemblers(); - ClangASTContext::Initialize(); + TypeSystemClang::Initialize(); #define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Initialize) #include "llvm/Config/Targets.def" @@ -268,7 +268,7 @@ // Terminate and unload and loaded system or user LLDB plug-ins PluginManager::Terminate(); - ClangASTContext::Terminate(); + TypeSystemClang::Terminate(); ArchitectureArm::Terminate(); ArchitectureMips::Terminate(); diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -18,7 +18,7 @@ #include "lldb/Initialization/SystemLifetimeManager.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SymbolFile.h" @@ -596,12 +596,12 @@ llvm::Expected type_system_or_err = symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus); if (!type_system_or_err) - return make_string_error("Can't retrieve ClangASTContext"); + return make_string_error("Can't retrieve TypeSystemClang"); auto *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) - return make_string_error("Retrieved TypeSystem was not a ClangASTContext"); + return make_string_error("Retrieved TypeSystem was not a TypeSystemClang"); clang::ASTContext &ast_ctx = clang_ast_ctx->getASTContext(); @@ -624,12 +624,12 @@ llvm::Expected type_system_or_err = symfile->GetTypeSystemForLanguage(eLanguageTypeObjC_plus_plus); if (!type_system_or_err) - return make_string_error("Can't retrieve ClangASTContext"); + return make_string_error("Can't retrieve TypeSystemClang"); auto *clang_ast_ctx = - llvm::dyn_cast_or_null(&type_system_or_err.get()); + llvm::dyn_cast_or_null(&type_system_or_err.get()); if (!clang_ast_ctx) - return make_string_error("Retrieved TypeSystem was not a ClangASTContext"); + return make_string_error("Retrieved TypeSystem was not a TypeSystemClang"); StreamString Stream; clang_ast_ctx->DumpFromSymbolFile(Stream, Name); diff --git a/lldb/unittests/Expression/ClangExpressionDeclMapTest.cpp b/lldb/unittests/Expression/ClangExpressionDeclMapTest.cpp --- a/lldb/unittests/Expression/ClangExpressionDeclMapTest.cpp +++ b/lldb/unittests/Expression/ClangExpressionDeclMapTest.cpp @@ -11,7 +11,7 @@ #include "TestingSupport/Symbol/ClangTestUtils.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/lldb-defines.h" #include "gtest/gtest.h" @@ -26,7 +26,7 @@ nullptr) { m_scratch_context = clang_utils::createAST(); } - std::unique_ptr m_scratch_context; + std::unique_ptr m_scratch_context; /// Adds a persistent decl that can be found by the ClangExpressionDeclMap /// via GetPersistentDecl. void AddPersistentDeclForTest(clang::NamedDecl *d) { @@ -63,7 +63,7 @@ std::unique_ptr decl_map; /// The target AST that lookup results should be imported to. - std::unique_ptr target_ast; + std::unique_ptr target_ast; void SetUp() override { importer = std::make_shared(); diff --git a/lldb/unittests/Symbol/CMakeLists.txt b/lldb/unittests/Symbol/CMakeLists.txt --- a/lldb/unittests/Symbol/CMakeLists.txt +++ b/lldb/unittests/Symbol/CMakeLists.txt @@ -1,7 +1,7 @@ add_lldb_unittest(SymbolTests LocateSymbolFileTest.cpp PostfixExpressionTest.cpp - TestClangASTContext.cpp + TestTypeSystemClang.cpp TestClangASTImporter.cpp TestDWARFCallFrameInfo.cpp TestType.cpp diff --git a/lldb/unittests/Symbol/TestClangASTImporter.cpp b/lldb/unittests/Symbol/TestClangASTImporter.cpp --- a/lldb/unittests/Symbol/TestClangASTImporter.cpp +++ b/lldb/unittests/Symbol/TestClangASTImporter.cpp @@ -12,7 +12,7 @@ #include "TestingSupport/Symbol/ClangTestUtils.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangASTImporter.h" #include "lldb/Symbol/ClangASTMetadata.h" #include "lldb/Symbol/ClangUtil.h" @@ -42,7 +42,7 @@ // Tests that the ClangASTImporter::CopyDecl can copy TagDecls. clang_utils::SourceASTWithRecord source; - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); ClangASTImporter importer; clang::Decl *imported = @@ -67,7 +67,7 @@ // Tests that the ClangASTImporter::CopyType can copy TagDecls types. clang_utils::SourceASTWithRecord source; - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); ClangASTImporter importer; CompilerType imported = importer.CopyType(*target_ast, source.record_type); @@ -92,7 +92,7 @@ // Tests that the ClangASTImporter::DeportDecl completely copies TagDecls. clang_utils::SourceASTWithRecord source; - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); ClangASTImporter importer; clang::Decl *imported = @@ -114,7 +114,7 @@ // Tests that the ClangASTImporter::CopyType can deport TagDecl types. clang_utils::SourceASTWithRecord source; - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); ClangASTImporter importer; CompilerType imported = importer.DeportType(*target_ast, source.record_type); @@ -139,7 +139,7 @@ const lldb::user_id_t metadata = 123456; source.ast->SetMetadataAsUserID(source.record_decl, metadata); - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); ClangASTImporter importer; clang::Decl *imported = @@ -161,14 +161,14 @@ const lldb::user_id_t metadata = 123456; source.ast->SetMetadataAsUserID(source.record_decl, metadata); - std::unique_ptr temporary_ast = clang_utils::createAST(); + std::unique_ptr temporary_ast = clang_utils::createAST(); ClangASTImporter importer; clang::Decl *temporary_imported = importer.CopyDecl(&temporary_ast->getASTContext(), source.record_decl); ASSERT_NE(nullptr, temporary_imported); - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); clang::Decl *imported = importer.CopyDecl(&target_ast->getASTContext(), temporary_imported); ASSERT_NE(nullptr, imported); @@ -185,7 +185,7 @@ clang_utils::SourceASTWithRecord source; const lldb::user_id_t metadata = 123456; - std::unique_ptr target_ast = clang_utils::createAST(); + std::unique_ptr target_ast = clang_utils::createAST(); ClangASTImporter importer; clang::Decl *imported = diff --git a/lldb/unittests/Symbol/TestLineEntry.cpp b/lldb/unittests/Symbol/TestLineEntry.cpp --- a/lldb/unittests/Symbol/TestLineEntry.cpp +++ b/lldb/unittests/Symbol/TestLineEntry.cpp @@ -16,7 +16,7 @@ #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" #include "TestingSupport/SubsystemRAII.h" #include "TestingSupport/TestUtilities.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Core/Module.h" #include "lldb/Host/FileSystem.h" @@ -33,7 +33,7 @@ class LineEntryTest : public testing::Test { SubsystemRAII + TypeSystemClang> subsystem; public: diff --git a/lldb/unittests/Symbol/TestClangASTContext.cpp b/lldb/unittests/Symbol/TestTypeSystemClang.cpp rename from lldb/unittests/Symbol/TestClangASTContext.cpp rename to lldb/unittests/Symbol/TestTypeSystemClang.cpp --- a/lldb/unittests/Symbol/TestClangASTContext.cpp +++ b/lldb/unittests/Symbol/TestTypeSystemClang.cpp @@ -1,4 +1,4 @@ -//===-- TestClangASTContext.cpp ---------------------------------*- C++ -*-===// +//===-- TestTypeSystemClang.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ #include "TestingSupport/Symbol/ClangTestUtils.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/Declaration.h" #include "clang/AST/DeclCXX.h" @@ -21,19 +21,19 @@ using namespace lldb; using namespace lldb_private; -class TestClangASTContext : public testing::Test { +class TestTypeSystemClang : public testing::Test { public: SubsystemRAII subsystems; void SetUp() override { m_ast.reset( - new ClangASTContext("test ASTContext", HostInfo::GetTargetTriple())); + new TypeSystemClang("test ASTContext", HostInfo::GetTargetTriple())); } void TearDown() override { m_ast.reset(); } protected: - std::unique_ptr m_ast; + std::unique_ptr m_ast; QualType GetBasicQualType(BasicType type) const { return ClangUtil::GetQualType(m_ast->GetBasicTypeFromAST(type)); @@ -45,7 +45,7 @@ } }; -TEST_F(TestClangASTContext, TestGetBasicTypeFromEnum) { +TEST_F(TestTypeSystemClang, TestGetBasicTypeFromEnum) { clang::ASTContext &context = m_ast->getASTContext(); EXPECT_TRUE( @@ -108,7 +108,7 @@ context.hasSameType(GetBasicQualType(eBasicTypeWChar), context.WCharTy)); } -TEST_F(TestClangASTContext, TestGetBasicTypeFromName) { +TEST_F(TestTypeSystemClang, TestGetBasicTypeFromName) { EXPECT_EQ(GetBasicQualType(eBasicTypeChar), GetBasicQualType("char")); EXPECT_EQ(GetBasicQualType(eBasicTypeSignedChar), GetBasicQualType("signed char")); @@ -159,7 +159,7 @@ EXPECT_EQ(GetBasicQualType(eBasicTypeNullPtr), GetBasicQualType("nullptr")); } -void VerifyEncodingAndBitSize(ClangASTContext &clang_context, +void VerifyEncodingAndBitSize(TypeSystemClang &clang_context, lldb::Encoding encoding, unsigned int bit_size) { clang::ASTContext &context = clang_context.getASTContext(); @@ -197,7 +197,7 @@ } } -TEST_F(TestClangASTContext, TestBuiltinTypeForEncodingAndBitSize) { +TEST_F(TestTypeSystemClang, TestBuiltinTypeForEncodingAndBitSize) { // Make sure we can get types of every possible size in every possible // encoding. // We can't make any guarantee about which specific type we get, because the @@ -221,20 +221,20 @@ VerifyEncodingAndBitSize(*m_ast, eEncodingIEEE754, 64); } -TEST_F(TestClangASTContext, TestDisplayName) { - ClangASTContext ast("some name", llvm::Triple()); +TEST_F(TestTypeSystemClang, TestDisplayName) { + TypeSystemClang ast("some name", llvm::Triple()); EXPECT_EQ("some name", ast.getDisplayName()); } -TEST_F(TestClangASTContext, TestDisplayNameEmpty) { - ClangASTContext ast("", llvm::Triple()); +TEST_F(TestTypeSystemClang, TestDisplayNameEmpty) { + TypeSystemClang ast("", llvm::Triple()); EXPECT_EQ("", ast.getDisplayName()); } -TEST_F(TestClangASTContext, TestIsClangType) { +TEST_F(TestTypeSystemClang, TestIsClangType) { clang::ASTContext &context = m_ast->getASTContext(); lldb::opaque_compiler_type_t bool_ctype = - ClangASTContext::GetOpaqueCompilerType(&context, lldb::eBasicTypeBool); + TypeSystemClang::GetOpaqueCompilerType(&context, lldb::eBasicTypeBool); CompilerType bool_type(m_ast.get(), bool_ctype); CompilerType record_type = m_ast->CreateRecordType( nullptr, lldb::eAccessPublic, "FooRecord", clang::TTK_Struct, @@ -247,7 +247,7 @@ EXPECT_FALSE(ClangUtil::IsClangType(CompilerType())); } -TEST_F(TestClangASTContext, TestRemoveFastQualifiers) { +TEST_F(TestTypeSystemClang, TestRemoveFastQualifiers) { CompilerType record_type = m_ast->CreateRecordType( nullptr, lldb::eAccessPublic, "FooRecord", clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr); @@ -265,84 +265,84 @@ EXPECT_EQ(0u, qt.getLocalFastQualifiers()); } -TEST_F(TestClangASTContext, TestConvertAccessTypeToAccessSpecifier) { +TEST_F(TestTypeSystemClang, TestConvertAccessTypeToAccessSpecifier) { EXPECT_EQ(AS_none, - ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessNone)); - EXPECT_EQ(AS_none, ClangASTContext::ConvertAccessTypeToAccessSpecifier( + TypeSystemClang::ConvertAccessTypeToAccessSpecifier(eAccessNone)); + EXPECT_EQ(AS_none, TypeSystemClang::ConvertAccessTypeToAccessSpecifier( eAccessPackage)); EXPECT_EQ(AS_public, - ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessPublic)); - EXPECT_EQ(AS_private, ClangASTContext::ConvertAccessTypeToAccessSpecifier( + TypeSystemClang::ConvertAccessTypeToAccessSpecifier(eAccessPublic)); + EXPECT_EQ(AS_private, TypeSystemClang::ConvertAccessTypeToAccessSpecifier( eAccessPrivate)); - EXPECT_EQ(AS_protected, ClangASTContext::ConvertAccessTypeToAccessSpecifier( + EXPECT_EQ(AS_protected, TypeSystemClang::ConvertAccessTypeToAccessSpecifier( eAccessProtected)); } -TEST_F(TestClangASTContext, TestUnifyAccessSpecifiers) { +TEST_F(TestTypeSystemClang, TestUnifyAccessSpecifiers) { // Unifying two of the same type should return the same type EXPECT_EQ(AS_public, - ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_public)); + TypeSystemClang::UnifyAccessSpecifiers(AS_public, AS_public)); EXPECT_EQ(AS_private, - ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_private)); + TypeSystemClang::UnifyAccessSpecifiers(AS_private, AS_private)); EXPECT_EQ(AS_protected, - ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_protected)); + TypeSystemClang::UnifyAccessSpecifiers(AS_protected, AS_protected)); // Otherwise the result should be the strictest of the two. EXPECT_EQ(AS_private, - ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_public)); + TypeSystemClang::UnifyAccessSpecifiers(AS_private, AS_public)); EXPECT_EQ(AS_private, - ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_protected)); + TypeSystemClang::UnifyAccessSpecifiers(AS_private, AS_protected)); EXPECT_EQ(AS_private, - ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_private)); + TypeSystemClang::UnifyAccessSpecifiers(AS_public, AS_private)); EXPECT_EQ(AS_private, - ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_private)); + TypeSystemClang::UnifyAccessSpecifiers(AS_protected, AS_private)); EXPECT_EQ(AS_protected, - ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_public)); + TypeSystemClang::UnifyAccessSpecifiers(AS_protected, AS_public)); EXPECT_EQ(AS_protected, - ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_protected)); + TypeSystemClang::UnifyAccessSpecifiers(AS_public, AS_protected)); // None is stricter than everything (by convention) EXPECT_EQ(AS_none, - ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_public)); + TypeSystemClang::UnifyAccessSpecifiers(AS_none, AS_public)); EXPECT_EQ(AS_none, - ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_protected)); + TypeSystemClang::UnifyAccessSpecifiers(AS_none, AS_protected)); EXPECT_EQ(AS_none, - ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_private)); + TypeSystemClang::UnifyAccessSpecifiers(AS_none, AS_private)); EXPECT_EQ(AS_none, - ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_none)); + TypeSystemClang::UnifyAccessSpecifiers(AS_public, AS_none)); EXPECT_EQ(AS_none, - ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_none)); + TypeSystemClang::UnifyAccessSpecifiers(AS_protected, AS_none)); EXPECT_EQ(AS_none, - ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_none)); + TypeSystemClang::UnifyAccessSpecifiers(AS_private, AS_none)); } -TEST_F(TestClangASTContext, TestRecordHasFields) { +TEST_F(TestTypeSystemClang, TestRecordHasFields) { CompilerType int_type = m_ast->GetBasicType(eBasicTypeInt); // Test that a record with no fields returns false CompilerType empty_base = m_ast->CreateRecordType( nullptr, lldb::eAccessPublic, "EmptyBase", clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr); - ClangASTContext::StartTagDeclarationDefinition(empty_base); - ClangASTContext::CompleteTagDeclarationDefinition(empty_base); + TypeSystemClang::StartTagDeclarationDefinition(empty_base); + TypeSystemClang::CompleteTagDeclarationDefinition(empty_base); - RecordDecl *empty_base_decl = ClangASTContext::GetAsRecordDecl(empty_base); + RecordDecl *empty_base_decl = TypeSystemClang::GetAsRecordDecl(empty_base); EXPECT_NE(nullptr, empty_base_decl); - EXPECT_FALSE(ClangASTContext::RecordHasFields(empty_base_decl)); + EXPECT_FALSE(TypeSystemClang::RecordHasFields(empty_base_decl)); // Test that a record with direct fields returns true CompilerType non_empty_base = m_ast->CreateRecordType( nullptr, lldb::eAccessPublic, "NonEmptyBase", clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr); - ClangASTContext::StartTagDeclarationDefinition(non_empty_base); + TypeSystemClang::StartTagDeclarationDefinition(non_empty_base); FieldDecl *non_empty_base_field_decl = m_ast->AddFieldToRecordType( non_empty_base, "MyField", int_type, eAccessPublic, 0); - ClangASTContext::CompleteTagDeclarationDefinition(non_empty_base); + TypeSystemClang::CompleteTagDeclarationDefinition(non_empty_base); RecordDecl *non_empty_base_decl = - ClangASTContext::GetAsRecordDecl(non_empty_base); + TypeSystemClang::GetAsRecordDecl(non_empty_base); EXPECT_NE(nullptr, non_empty_base_decl); EXPECT_NE(nullptr, non_empty_base_field_decl); - EXPECT_TRUE(ClangASTContext::RecordHasFields(non_empty_base_decl)); + EXPECT_TRUE(TypeSystemClang::RecordHasFields(non_empty_base_decl)); std::vector> bases; @@ -350,50 +350,50 @@ CompilerType empty_derived = m_ast->CreateRecordType( nullptr, lldb::eAccessPublic, "EmptyDerived", clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr); - ClangASTContext::StartTagDeclarationDefinition(empty_derived); + TypeSystemClang::StartTagDeclarationDefinition(empty_derived); std::unique_ptr non_empty_base_spec = m_ast->CreateBaseClassSpecifier(non_empty_base.GetOpaqueQualType(), lldb::eAccessPublic, false, false); bases.push_back(std::move(non_empty_base_spec)); bool result = m_ast->TransferBaseClasses(empty_derived.GetOpaqueQualType(), std::move(bases)); - ClangASTContext::CompleteTagDeclarationDefinition(empty_derived); + TypeSystemClang::CompleteTagDeclarationDefinition(empty_derived); EXPECT_TRUE(result); CXXRecordDecl *empty_derived_non_empty_base_cxx_decl = m_ast->GetAsCXXRecordDecl(empty_derived.GetOpaqueQualType()); RecordDecl *empty_derived_non_empty_base_decl = - ClangASTContext::GetAsRecordDecl(empty_derived); - EXPECT_EQ(1u, ClangASTContext::GetNumBaseClasses( + TypeSystemClang::GetAsRecordDecl(empty_derived); + EXPECT_EQ(1u, TypeSystemClang::GetNumBaseClasses( empty_derived_non_empty_base_cxx_decl, false)); EXPECT_TRUE( - ClangASTContext::RecordHasFields(empty_derived_non_empty_base_decl)); + TypeSystemClang::RecordHasFields(empty_derived_non_empty_base_decl)); // Test that a record with no direct fields, but fields in a virtual base // returns true CompilerType empty_derived2 = m_ast->CreateRecordType( nullptr, lldb::eAccessPublic, "EmptyDerived2", clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr); - ClangASTContext::StartTagDeclarationDefinition(empty_derived2); + TypeSystemClang::StartTagDeclarationDefinition(empty_derived2); std::unique_ptr non_empty_vbase_spec = m_ast->CreateBaseClassSpecifier(non_empty_base.GetOpaqueQualType(), lldb::eAccessPublic, true, false); bases.push_back(std::move(non_empty_vbase_spec)); result = m_ast->TransferBaseClasses(empty_derived2.GetOpaqueQualType(), std::move(bases)); - ClangASTContext::CompleteTagDeclarationDefinition(empty_derived2); + TypeSystemClang::CompleteTagDeclarationDefinition(empty_derived2); EXPECT_TRUE(result); CXXRecordDecl *empty_derived_non_empty_vbase_cxx_decl = m_ast->GetAsCXXRecordDecl(empty_derived2.GetOpaqueQualType()); RecordDecl *empty_derived_non_empty_vbase_decl = - ClangASTContext::GetAsRecordDecl(empty_derived2); - EXPECT_EQ(1u, ClangASTContext::GetNumBaseClasses( + TypeSystemClang::GetAsRecordDecl(empty_derived2); + EXPECT_EQ(1u, TypeSystemClang::GetNumBaseClasses( empty_derived_non_empty_vbase_cxx_decl, false)); EXPECT_TRUE( - ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl)); + TypeSystemClang::RecordHasFields(empty_derived_non_empty_vbase_decl)); } -TEST_F(TestClangASTContext, TemplateArguments) { - ClangASTContext::TemplateParameterInfos infos; +TEST_F(TestTypeSystemClang, TemplateArguments) { + TypeSystemClang::TemplateParameterInfos infos; infos.names.push_back("T"); infos.args.push_back(TemplateArgument(m_ast->getASTContext().IntTy)); infos.names.push_back("I"); @@ -456,34 +456,34 @@ return result; } -TEST_F(TestClangASTContext, TestGetTypeClassDeclType) { +TEST_F(TestTypeSystemClang, TestGetTypeClassDeclType) { clang::ASTContext &ctxt = m_ast->getASTContext(); auto *nullptr_expr = new (ctxt) CXXNullPtrLiteralExpr(ctxt.NullPtrTy, SourceLocation()); QualType t = ctxt.getDecltypeType(nullptr_expr, makeConstInt(ctxt)); EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr())); } -TEST_F(TestClangASTContext, TestGetTypeClassTypeOf) { +TEST_F(TestTypeSystemClang, TestGetTypeClassTypeOf) { clang::ASTContext &ctxt = m_ast->getASTContext(); QualType t = ctxt.getTypeOfType(makeConstInt(ctxt)); EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr())); } -TEST_F(TestClangASTContext, TestGetTypeClassTypeOfExpr) { +TEST_F(TestTypeSystemClang, TestGetTypeClassTypeOfExpr) { clang::ASTContext &ctxt = m_ast->getASTContext(); auto *nullptr_expr = new (ctxt) CXXNullPtrLiteralExpr(ctxt.NullPtrTy, SourceLocation()); QualType t = ctxt.getTypeOfExprType(nullptr_expr); EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr())); } -TEST_F(TestClangASTContext, TestGetTypeClassNested) { +TEST_F(TestTypeSystemClang, TestGetTypeClassNested) { clang::ASTContext &ctxt = m_ast->getASTContext(); QualType t_base = ctxt.getTypeOfType(makeConstInt(ctxt)); QualType t = ctxt.getTypeOfType(t_base); EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr())); } -TEST_F(TestClangASTContext, TestFunctionTemplateConstruction) { +TEST_F(TestTypeSystemClang, TestFunctionTemplateConstruction) { // Tests creating a function template. CompilerType int_type = m_ast->GetBasicType(lldb::eBasicTypeInt); @@ -494,7 +494,7 @@ m_ast->CreateFunctionType(int_type, nullptr, 0U, false, 0U); FunctionDecl *func = m_ast->CreateFunctionDeclaration(TU, "foo", clang_type, 0, false); - ClangASTContext::TemplateParameterInfos empty_params; + TypeSystemClang::TemplateParameterInfos empty_params; // Create the actual function template. clang::FunctionTemplateDecl *func_template = @@ -505,7 +505,7 @@ EXPECT_EQ(clang::AccessSpecifier::AS_none, func_template->getAccess()); } -TEST_F(TestClangASTContext, TestFunctionTemplateInRecordConstruction) { +TEST_F(TestTypeSystemClang, TestFunctionTemplateInRecordConstruction) { // Tests creating a function template inside a record. CompilerType int_type = m_ast->GetBasicType(lldb::eBasicTypeInt); @@ -524,7 +524,7 @@ // 2. It is mirroring the behavior of DWARFASTParserClang::ParseSubroutine. FunctionDecl *func = m_ast->CreateFunctionDeclaration(TU, "foo", clang_type, 0, false); - ClangASTContext::TemplateParameterInfos empty_params; + TypeSystemClang::TemplateParameterInfos empty_params; // Create the actual function template. clang::FunctionTemplateDecl *func_template = @@ -535,7 +535,7 @@ EXPECT_EQ(clang::AccessSpecifier::AS_public, func_template->getAccess()); } -TEST_F(TestClangASTContext, TestDeletingImplicitCopyCstrDueToMoveCStr) { +TEST_F(TestTypeSystemClang, TestDeletingImplicitCopyCstrDueToMoveCStr) { // We need to simulate this behavior in our AST that we construct as we don't // have a Sema instance that can do this for us: // C++11 [class.copy]p7, p18: @@ -577,7 +577,7 @@ EXPECT_FALSE(record->hasSimpleCopyConstructor()); } -TEST_F(TestClangASTContext, TestNotDeletingUserCopyCstrDueToMoveCStr) { +TEST_F(TestTypeSystemClang, TestNotDeletingUserCopyCstrDueToMoveCStr) { // Tests that we don't delete the a user-defined copy constructor when // a move constructor is provided. // See also the TestDeletingImplicitCopyCstrDueToMoveCStr test. diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp --- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp +++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp @@ -17,7 +17,7 @@ using namespace lldb_private; class DWARFASTParserClangTests : public testing::Test { - SubsystemRAII subsystems; + SubsystemRAII subsystems; }; namespace { @@ -39,7 +39,7 @@ // defining here, causing this test to fail, feel free to delete it. TEST_F(DWARFASTParserClangTests, EnsureAllDIEsInDeclContextHaveBeenParsedParsesOnlyMatchingEntries) { - ClangASTContext ast_ctx("dummy ASTContext", HostInfoBase::GetTargetTriple()); + TypeSystemClang ast_ctx("dummy ASTContext", HostInfoBase::GetTargetTriple()); DWARFASTParserClangStub ast_parser(ast_ctx); DWARFUnit *unit = nullptr; diff --git a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp --- a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp +++ b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp @@ -27,7 +27,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Utility/ArchSpec.h" @@ -42,7 +42,7 @@ class SymbolFileDWARFTests : public testing::Test { SubsystemRAII + TypeSystemClang, SymbolFilePDB> subsystems; public: diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -24,7 +24,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/TypeMap.h" @@ -54,7 +54,7 @@ HostInfo::Initialize(); ObjectFilePECOFF::Initialize(); SymbolFileDWARF::Initialize(); - ClangASTContext::Initialize(); + TypeSystemClang::Initialize(); SymbolFilePDB::Initialize(); m_pdb_test_exe = GetInputFilePath("test-pdb.exe"); @@ -63,7 +63,7 @@ void TearDown() override { SymbolFilePDB::Terminate(); - ClangASTContext::Initialize(); + TypeSystemClang::Initialize(); SymbolFileDWARF::Terminate(); ObjectFilePECOFF::Terminate(); HostInfo::Terminate(); @@ -360,7 +360,7 @@ lldb::TypeSP udt_type = results.GetTypeAtIndex(0); EXPECT_EQ(ConstString("Class"), udt_type->GetName()); CompilerType compiler_type = udt_type->GetForwardCompilerType(); - EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType())); + EXPECT_TRUE(TypeSystemClang::IsClassType(compiler_type.GetOpaqueQualType())); EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_Class"), udt_type->GetByteSize()); } @@ -381,7 +381,7 @@ ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded()); auto clang_ast_ctx = - llvm::dyn_cast_or_null(&clang_ast_ctx_or_err.get()); + llvm::dyn_cast_or_null(&clang_ast_ctx_or_err.get()); EXPECT_NE(nullptr, clang_ast_ctx); symfile->FindTypes(ConstString("Class"), nullptr, 0, searched_files, results); @@ -412,7 +412,7 @@ EXPECT_EQ(ConstString("NestedClass"), udt_type->GetName()); CompilerType compiler_type = udt_type->GetForwardCompilerType(); - EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType())); + EXPECT_TRUE(TypeSystemClang::IsClassType(compiler_type.GetOpaqueQualType())); EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NestedClass"), udt_type->GetByteSize()); @@ -434,7 +434,7 @@ ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded()); auto clang_ast_ctx = - llvm::dyn_cast_or_null(&clang_ast_ctx_or_err.get()); + llvm::dyn_cast_or_null(&clang_ast_ctx_or_err.get()); EXPECT_NE(nullptr, clang_ast_ctx); clang::ASTContext &ast_ctx = clang_ast_ctx->getASTContext(); @@ -456,7 +456,7 @@ EXPECT_EQ(ConstString("NSClass"), udt_type->GetName()); CompilerType compiler_type = udt_type->GetForwardCompilerType(); - EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType())); + EXPECT_TRUE(TypeSystemClang::IsClassType(compiler_type.GetOpaqueQualType())); EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NSClass"), udt_type->GetByteSize()); @@ -479,8 +479,8 @@ lldb::TypeSP enum_type = results.GetTypeAtIndex(0); EXPECT_EQ(ConstString(Enum), enum_type->GetName()); CompilerType compiler_type = enum_type->GetFullCompilerType(); - EXPECT_TRUE(ClangASTContext::IsEnumType(compiler_type.GetOpaqueQualType())); - clang::EnumDecl *enum_decl = ClangASTContext::GetAsEnumDecl(compiler_type); + EXPECT_TRUE(TypeSystemClang::IsEnumType(compiler_type.GetOpaqueQualType())); + clang::EnumDecl *enum_decl = TypeSystemClang::GetAsEnumDecl(compiler_type); EXPECT_NE(nullptr, enum_decl); EXPECT_EQ(2, std::distance(enum_decl->enumerator_begin(), enum_decl->enumerator_end())); @@ -528,8 +528,8 @@ lldb::TypeSP typedef_type = results.GetTypeAtIndex(0); EXPECT_EQ(ConstString(Typedef), typedef_type->GetName()); CompilerType compiler_type = typedef_type->GetFullCompilerType(); - ClangASTContext *clang_type_system = - llvm::dyn_cast_or_null(compiler_type.GetTypeSystem()); + TypeSystemClang *clang_type_system = + llvm::dyn_cast_or_null(compiler_type.GetTypeSystem()); EXPECT_TRUE( clang_type_system->IsTypedefType(compiler_type.GetOpaqueQualType())); diff --git a/lldb/unittests/TestingSupport/Symbol/ClangTestUtils.h b/lldb/unittests/TestingSupport/Symbol/ClangTestUtils.h --- a/lldb/unittests/TestingSupport/Symbol/ClangTestUtils.h +++ b/lldb/unittests/TestingSupport/Symbol/ClangTestUtils.h @@ -10,23 +10,23 @@ #define LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_CLANGTESTUTILS_H #include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/TypeSystemClang.h" #include "lldb/Symbol/ClangUtil.h" namespace lldb_private { namespace clang_utils { -inline clang::DeclarationName getDeclarationName(ClangASTContext &ast, +inline clang::DeclarationName getDeclarationName(TypeSystemClang &ast, llvm::StringRef name) { clang::IdentifierInfo &II = ast.getASTContext().Idents.get(name); return ast.getASTContext().DeclarationNames.getIdentifier(&II); } -inline std::unique_ptr createAST() { - return std::make_unique("test ASTContext", +inline std::unique_ptr createAST() { + return std::make_unique("test ASTContext", HostInfo::GetTargetTriple()); } -inline CompilerType createRecord(ClangASTContext &ast, llvm::StringRef name) { +inline CompilerType createRecord(TypeSystemClang &ast, llvm::StringRef name) { return ast.CreateRecordType(ast.getASTContext().getTranslationUnitDecl(), lldb::AccessType::eAccessPublic, name, 0, lldb::LanguageType::eLanguageTypeC); @@ -34,25 +34,25 @@ /// Create a record with the given name and a field with the given type /// and name. -inline CompilerType createRecordWithField(ClangASTContext &ast, +inline CompilerType createRecordWithField(TypeSystemClang &ast, llvm::StringRef record_name, CompilerType field_type, llvm::StringRef field_name) { CompilerType t = createRecord(ast, record_name); - ClangASTContext::StartTagDeclarationDefinition(t); + TypeSystemClang::StartTagDeclarationDefinition(t); ast.AddFieldToRecordType(t, field_name, field_type, lldb::AccessType::eAccessPublic, 7); - ClangASTContext::CompleteTagDeclarationDefinition(t); + TypeSystemClang::CompleteTagDeclarationDefinition(t); return t; } -/// Constructs a ClangASTContext that contains a single RecordDecl that contains +/// Constructs a TypeSystemClang that contains a single RecordDecl that contains /// a single FieldDecl. Utility class as this setup is a common starting point /// for unit test that exercise the ASTImporter. struct SourceASTWithRecord { - std::unique_ptr ast; + std::unique_ptr ast; CompilerType record_type; clang::RecordDecl *record_decl = nullptr; clang::FieldDecl *field_decl = nullptr;