Author: Raphael Isemann Date: 2020-01-30T12:07:19+01:00 New Revision: df8a986f533d6b1726e79acfa53ba854943704c3
URL: https://github.com/llvm/llvm-project/commit/df8a986f533d6b1726e79acfa53ba854943704c3 DIFF: https://github.com/llvm/llvm-project/commit/df8a986f533d6b1726e79acfa53ba854943704c3.diff LOG: [lldb][NFC] Remove TypeSystemClang::GetASTContext calls in IRForTarget Similar to previous commits, this just replaces the lookup in the global map with the reference to the TypeSystemClang instance we already have in this context. Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h index 52fb0d1f4eae..2b711db7a5a5 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h @@ -356,6 +356,10 @@ class ClangASTSource : public clang::ExternalASTSource, /// True if lookup succeeded; false otherwise. ClangASTImporter::DeclOrigin GetDeclOrigin(const clang::Decl *decl); + /// Returns the TypeSystem that uses this ClangASTSource instance as it's + /// ExternalASTSource. + TypeSystemClang *GetTypeSystem() const { return m_clang_ast_context; } + protected: bool FindObjCMethodDeclsWithOrigin( unsigned int current_id, NameSearchContext &context, diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 0a0314dd4b75..bcf13e5c877c 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -283,17 +283,13 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { clang::QualType element_qual_type = pointer_pointertype->getPointeeType(); m_result_type = lldb_private::TypeFromParser( - element_qual_type.getAsOpaquePtr(), - lldb_private::TypeSystemClang::GetASTContext( - &result_decl->getASTContext())); + m_decl_map->GetTypeSystem()->GetType(element_qual_type)); } else if (pointer_objcobjpointertype) { clang::QualType element_qual_type = clang::QualType(pointer_objcobjpointertype->getObjectType(), 0); m_result_type = lldb_private::TypeFromParser( - element_qual_type.getAsOpaquePtr(), - lldb_private::TypeSystemClang::GetASTContext( - &result_decl->getASTContext())); + m_decl_map->GetTypeSystem()->GetType(element_qual_type)); } else { LLDB_LOG(log, "Expected result to have pointer type, but it did not"); @@ -305,9 +301,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { } } else { m_result_type = lldb_private::TypeFromParser( - result_var->getType().getAsOpaquePtr(), - lldb_private::TypeSystemClang::GetASTContext( - &result_decl->getASTContext())); + m_decl_map->GetTypeSystem()->GetType(result_var->getType())); } lldb::TargetSP target_sp(m_execution_unit.GetTarget()); @@ -1094,8 +1088,7 @@ bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) { clang::VarDecl *decl = reinterpret_cast<clang::VarDecl *>(ptr); lldb_private::TypeFromParser result_decl_type( - decl->getType().getAsOpaquePtr(), - lldb_private::TypeSystemClang::GetASTContext(&decl->getASTContext())); + m_decl_map->GetTypeSystem()->GetType(decl->getType())); StringRef decl_name(decl->getName()); lldb_private::ConstString persistent_variable_name(decl_name.data(), @@ -1225,10 +1218,8 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) { if (value_decl == nullptr) return false; - lldb_private::CompilerType compiler_type( - lldb_private::TypeSystemClang::GetASTContext( - &value_decl->getASTContext()), - value_decl->getType().getAsOpaquePtr()); + lldb_private::CompilerType compiler_type = + m_decl_map->GetTypeSystem()->GetType(value_decl->getType()); const Type *value_type = nullptr; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits