From 54c912f725c78bb4b797618af1c22ad02801d39c Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 13 Aug 2019 19:40:36 +0000 Subject: [Symbol] Decouple clang from CompilerType Summary: Ideally CompilerType would have no knowledge of clang or any individual TypeSystem. Decoupling clang is relatively straightforward. Differential Revision: https://reviews.llvm.org/D66102 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@368741 91177308-0d34-0410-b5e6-96231b3b80d8 --- source/Plugins/Language/ObjC/NSArray.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'source/Plugins/Language/ObjC') diff --git a/source/Plugins/Language/ObjC/NSArray.cpp b/source/Plugins/Language/ObjC/NSArray.cpp index 404dabf28..7219c016d 100644 --- a/source/Plugins/Language/ObjC/NSArray.cpp +++ b/source/Plugins/Language/ObjC/NSArray.cpp @@ -461,12 +461,13 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::NSArrayMSyntheticFrontE : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), m_id_type() { if (valobj_sp) { - clang::ASTContext *ast = valobj_sp->GetExecutionContextRef() - .GetTargetSP() - ->GetScratchClangASTContext() - ->getASTContext(); - if (ast) - m_id_type = CompilerType(ast, ast->ObjCBuiltinIdTy); + auto *clang_ast_context = valobj_sp->GetExecutionContextRef() + .GetTargetSP() + ->GetScratchClangASTContext(); + if (clang_ast_context) + m_id_type = CompilerType( + clang_ast_context, + clang_ast_context->getASTContext()->ObjCBuiltinIdTy.getAsOpaquePtr()); if (valobj_sp->GetProcessSP()) m_ptr_size = valobj_sp->GetProcessSP()->GetAddressByteSize(); } @@ -609,12 +610,13 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: if (valobj_sp) { CompilerType type = valobj_sp->GetCompilerType(); if (type) { - ClangASTContext *ast = valobj_sp->GetExecutionContextRef() - .GetTargetSP() - ->GetScratchClangASTContext(); - if (ast) - m_id_type = CompilerType(ast->getASTContext(), - ast->getASTContext()->ObjCBuiltinIdTy); + auto *clang_ast_context = valobj_sp->GetExecutionContextRef() + .GetTargetSP() + ->GetScratchClangASTContext(); + if (clang_ast_context) + m_id_type = CompilerType(clang_ast_context, + clang_ast_context->getASTContext() + ->ObjCBuiltinIdTy.getAsOpaquePtr()); } } } -- cgit v1.2.3