[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.
This commit is contained in:
Raphael Isemann 2020-01-30 11:53:41 +01:00
parent 5f8e51a9d4
commit df8a986f53
2 changed files with 10 additions and 15 deletions

View File

@ -356,6 +356,10 @@ public:
/// 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,

View File

@ -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;