Revert "Introduce a TypeSystem interface to support adding non-clang languages."

This seems to break expression evaluation on the linux build.

llvm-svn: 239366
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index d00e455..7574723 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -201,10 +201,10 @@
         if (target == NULL)
             return false;
 
-        ClangASTContext *context(target->GetScratchClangASTContext());
+        ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
 
-        TypeFromUser user_type(m_ast_importer->DeportType(context->getASTContext(),
-                                                          parser_type.GetTypeSystem()->AsClangASTContext()->getASTContext(),
+        TypeFromUser user_type(m_ast_importer->DeportType(context,
+                                                          parser_type.GetASTContext(),
                                                           parser_type.GetOpaqueQualType()),
                                context);
 
@@ -241,10 +241,10 @@
     if (target == NULL)
         return false;
 
-    ClangASTContext *context(target->GetScratchClangASTContext());
+    ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
 
-    TypeFromUser user_type(m_ast_importer->DeportType(context->getASTContext(),
-                                                      parser_type.GetTypeSystem()->AsClangASTContext()->getASTContext(),
+    TypeFromUser user_type(m_ast_importer->DeportType(context,
+                                                      parser_type.GetASTContext(),
                                                       parser_type.GetOpaqueQualType()),
                            context);
 
@@ -1041,7 +1041,7 @@
                 QualType class_qual_type(class_decl->getTypeForDecl(), 0);
 
                 TypeFromUser class_user_type (class_qual_type.getAsOpaquePtr(),
-                                              ClangASTContext::GetASTContext(&class_decl->getASTContext()));
+                                              &class_decl->getASTContext());
 
                 if (log)
                 {
@@ -1079,7 +1079,7 @@
                     QualType class_pointer_type = method_decl->getASTContext().getPointerType(class_qual_type);
 
                     TypeFromUser self_user_type(class_pointer_type.getAsOpaquePtr(),
-                                                ClangASTContext::GetASTContext(&method_decl->getASTContext()));
+                                                &method_decl->getASTContext());
 
                     m_struct_vars->m_object_pointer_type = self_user_type;
                 }
@@ -1169,7 +1169,7 @@
                     return; // This is unlikely, but we have seen crashes where this occurred
 
                 TypeFromUser class_user_type(QualType(interface_type, 0).getAsOpaquePtr(),
-                                             ClangASTContext::GetASTContext(&method_decl->getASTContext()));
+                                             &method_decl->getASTContext());
 
                 if (log)
                 {
@@ -1186,7 +1186,7 @@
                     QualType class_pointer_type = method_decl->getASTContext().getObjCObjectPointerType(QualType(interface_type, 0));
 
                     TypeFromUser self_user_type(class_pointer_type.getAsOpaquePtr(),
-                                                ClangASTContext::GetASTContext(&method_decl->getASTContext()));
+                                                &method_decl->getASTContext());
 
                     m_struct_vars->m_object_pointer_type = self_user_type;
                 }
@@ -1196,7 +1196,7 @@
                     QualType class_type = method_decl->getASTContext().getObjCClassType();
 
                     TypeFromUser self_user_type(class_type.getAsOpaquePtr(),
-                                                ClangASTContext::GetASTContext(&method_decl->getASTContext()));
+                                                &method_decl->getASTContext());
 
                     m_struct_vars->m_object_pointer_type = self_user_type;
                 }
@@ -1225,11 +1225,11 @@
 
                     ClangASTType self_clang_type = self_type->GetClangFullType();
 
-                    if (ClangASTContext::IsObjCClassType(self_clang_type))
+                    if (self_clang_type.IsObjCClassType())
                     {
                         return;
                     }
-                    else if (ClangASTContext::IsObjCObjectPointerType(self_clang_type))
+                    else if (self_clang_type.IsObjCObjectPointerType())
                     {
                         self_clang_type = self_clang_type.GetPointeeType();
 
@@ -1726,7 +1726,7 @@
     if (is_reference)
         var_decl = context.AddVarDecl(pt);
     else
-        var_decl = context.AddVarDecl(ClangASTContext::GetLValueReferenceType(pt));
+        var_decl = context.AddVarDecl(pt.GetLValueReferenceType());
 
     std::string decl_name(context.m_decl_name.getAsString());
     ConstString entity_name(decl_name.c_str());
@@ -1770,7 +1770,7 @@
         return;
     }
 
-    NamedDecl *var_decl = context.AddVarDecl(ClangASTContext::GetLValueReferenceType(parser_type));
+    NamedDecl *var_decl = context.AddVarDecl(parser_type.GetLValueReferenceType());
 
     pvar_sp->EnableParserVars(GetParserID());
     ClangExpressionVariable::ParserVars *parser_vars = pvar_sp->GetParserVars(GetParserID());
@@ -1802,8 +1802,8 @@
 
     ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext();
 
-    TypeFromUser user_type (ClangASTContext::GetLValueReferenceType(ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType()));
-    TypeFromParser parser_type (ClangASTContext::GetLValueReferenceType(ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType()));
+    TypeFromUser user_type (ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
+    TypeFromParser parser_type (ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
     NamedDecl *var_decl = context.AddVarDecl(parser_type);
 
     std::string decl_name(context.m_decl_name.getAsString());
@@ -1845,7 +1845,7 @@
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
 
-    ClangASTContext *scratch_ast_context = target->GetScratchClangASTContext();
+    ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext();
 
     for (size_t index = 0, num_entities = m_found_entities.GetSize();
          index < num_entities;
@@ -1874,9 +1874,9 @@
             }
 
             QualType var_type = var_decl->getType();
-            TypeFromParser parser_type(var_type.getAsOpaquePtr(), ClangASTContext::GetASTContext(&var_decl->getASTContext()));
+            TypeFromParser parser_type(var_type.getAsOpaquePtr(), &var_decl->getASTContext());
 
-            lldb::clang_type_t copied_type = m_ast_importer->CopyType(scratch_ast_context->getASTContext(), &var_decl->getASTContext(), var_type.getAsOpaquePtr());
+            lldb::clang_type_t copied_type = m_ast_importer->CopyType(scratch_ast_context, &var_decl->getASTContext(), var_type.getAsOpaquePtr());
 
             if (!copied_type)
             {
@@ -2114,17 +2114,15 @@
         const bool is_attr_used = true;
         const bool is_artificial = false;
 
-        ClangASTContext::GetASTContext(m_ast_context)->
-            AddMethodToCXXRecordType (copied_clang_type.GetOpaqueQualType(),
-                                      "$__lldb_expr",
-                                      method_type,
-                                      lldb::eAccessPublic,
-                                      is_virtual,
-                                      is_static,
-                                      is_inline,
-                                      is_explicit,
-                                      is_attr_used,
-                                      is_artificial);
+        copied_clang_type.AddMethodToCXXRecordType ("$__lldb_expr",
+                                                    method_type,
+                                                    lldb::eAccessPublic,
+                                                    is_virtual,
+                                                    is_static,
+                                                    is_inline,
+                                                    is_explicit,
+                                                    is_attr_used,
+                                                    is_artificial);
     }
 
     return TypeFromParser(copied_clang_type);