[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

llvm-svn: 368741
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index 404dabf..7219c01 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -461,12 +461,13 @@
     : 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 @@
   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());
     }
   }
 }