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/DataFormatters/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
index 507d671..49eacee 100644
--- a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
+++ b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
@@ -312,8 +312,7 @@
     if (data_addr == 0 || data_addr == LLDB_INVALID_ADDRESS)
         return false;
 
-    ClangASTContext* lldb_ast = valobj.GetClangType().GetTypeSystem()->AsClangASTContext();
-    clang::ASTContext* ast = lldb_ast ? lldb_ast->getASTContext() : nullptr;
+    clang::ASTContext* ast = valobj.GetClangType().GetASTContext();
     
     if (!ast)
         return false;
diff --git a/lldb/source/DataFormatters/CoreMedia.cpp b/lldb/source/DataFormatters/CoreMedia.cpp
index 172bdf0..5c33c0b 100644
--- a/lldb/source/DataFormatters/CoreMedia.cpp
+++ b/lldb/source/DataFormatters/CoreMedia.cpp
@@ -21,9 +21,7 @@
 bool
 lldb_private::formatters::CMTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
 {
-    if (!valobj.GetClangType().IsValid())
-        return false;
-    ClangASTContext *ast_ctx = valobj.GetClangType().GetTypeSystem()->AsClangASTContext();
+    ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(valobj.GetClangType().GetASTContext());
     if (!ast_ctx)
         return false;
     
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index f994e32..7132a68 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -171,7 +171,7 @@
                                    bool did_strip_typedef,
                                    bool root_level)
 {
-    clang_type = ClangASTContext::RemoveFastQualifiers(clang_type);
+    clang_type = clang_type.RemoveFastQualifiers();
     ConstString type_name(clang_type.GetConstTypeName());
     if (valobj.GetBitfieldBitSize() > 0)
     {
@@ -201,7 +201,7 @@
         if (non_ref_type.IsTypedefType())
         {
             ClangASTType deffed_referenced_type = non_ref_type.GetTypedefedType();
-            deffed_referenced_type = is_rvalue_ref ? ClangASTContext::GetRValueReferenceType(deffed_referenced_type) : ClangASTContext::GetRValueReferenceType(deffed_referenced_type);
+            deffed_referenced_type = is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType() : deffed_referenced_type.GetLValueReferenceType();
             GetPossibleMatches(valobj,
                                deffed_referenced_type,
                                reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
diff --git a/lldb/source/DataFormatters/LibCxxInitializerList.cpp b/lldb/source/DataFormatters/LibCxxInitializerList.cpp
index 1f79f00..0dcef98 100644
--- a/lldb/source/DataFormatters/LibCxxInitializerList.cpp
+++ b/lldb/source/DataFormatters/LibCxxInitializerList.cpp
@@ -101,7 +101,7 @@
     m_num_elements = 0;
     m_children.clear();
     lldb::TemplateArgumentKind kind;
-    m_element_type = ClangASTContext::GetTemplateArgument(m_backend.GetClangType(), 0, kind);
+    m_element_type = m_backend.GetClangType().GetTemplateArgument(0, kind);
     if (kind != lldb::eTemplateArgumentKindType || false == m_element_type.IsValid())
         return false;
     
diff --git a/lldb/source/DataFormatters/LibCxxList.cpp b/lldb/source/DataFormatters/LibCxxList.cpp
index e70cd91..f3e07fe 100644
--- a/lldb/source/DataFormatters/LibCxxList.cpp
+++ b/lldb/source/DataFormatters/LibCxxList.cpp
@@ -335,10 +335,10 @@
     if (list_type.IsReferenceType())
         list_type = list_type.GetNonReferenceType();
 
-    if (ClangASTContext::GetNumTemplateArguments(list_type) == 0)
+    if (list_type.GetNumTemplateArguments() == 0)
         return false;
     lldb::TemplateArgumentKind kind;
-    m_element_type = ClangASTContext::GetTemplateArgument(list_type, 0, kind);
+    m_element_type = list_type.GetTemplateArgument(0, kind);
     m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
     m_tail = impl_sp->GetChildMemberWithName(ConstString("__prev_"), true).get();
     return false;
diff --git a/lldb/source/DataFormatters/LibCxxMap.cpp b/lldb/source/DataFormatters/LibCxxMap.cpp
index 2782a3b0..2ff6232 100644
--- a/lldb/source/DataFormatters/LibCxxMap.cpp
+++ b/lldb/source/DataFormatters/LibCxxMap.cpp
@@ -279,7 +279,7 @@
 bool
 lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType()
 {
-    if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem())
+    if (m_element_type.GetOpaqueQualType() && m_element_type.GetASTContext())
         return true;
     m_element_type.Clear();
     ValueObjectSP deref;
diff --git a/lldb/source/DataFormatters/LibStdcpp.cpp b/lldb/source/DataFormatters/LibStdcpp.cpp
index 16ee2c1..2b3bcb5 100644
--- a/lldb/source/DataFormatters/LibStdcpp.cpp
+++ b/lldb/source/DataFormatters/LibStdcpp.cpp
@@ -79,10 +79,10 @@
     m_pair_address += (is_64bit ? 32 : 16);
     
     ClangASTType my_type(valobj_sp->GetClangType());
-    if (ClangASTContext::GetNumTemplateArguments(my_type) >= 1)
+    if (my_type.GetNumTemplateArguments() >= 1)
     {
         TemplateArgumentKind kind;
-        ClangASTType pair_type = ClangASTContext::GetTemplateArgument(my_type, 0, kind);
+        ClangASTType pair_type = my_type.GetTemplateArgument(0, kind);
         if (kind != eTemplateArgumentKindType && kind != eTemplateArgumentKindTemplate && kind != eTemplateArgumentKindTemplateExpansion)
             return false;
         m_pair_type = pair_type;
diff --git a/lldb/source/DataFormatters/NSArray.cpp b/lldb/source/DataFormatters/NSArray.cpp
index 0e665bd..640982e 100644
--- a/lldb/source/DataFormatters/NSArray.cpp
+++ b/lldb/source/DataFormatters/NSArray.cpp
@@ -528,11 +528,11 @@
     m_items (0),
     m_data_ptr (0)
 {
-    if (valobj_sp && valobj_sp->GetClangType().IsValid())
+    if (valobj_sp)
     {
-        ClangASTContext *ast = valobj_sp->GetClangType().GetTypeSystem()->AsClangASTContext();
+        clang::ASTContext *ast = valobj_sp->GetClangType().GetASTContext();
         if (ast)
-            m_id_type = ClangASTType(ast->getASTContext(), ast->getASTContext()->ObjCBuiltinIdTy);
+            m_id_type = ClangASTType(ast, ast->ObjCBuiltinIdTy);
     }
 }
 
diff --git a/lldb/source/DataFormatters/NSDictionary.cpp b/lldb/source/DataFormatters/NSDictionary.cpp
index 30e9d34..30bc3ac 100644
--- a/lldb/source/DataFormatters/NSDictionary.cpp
+++ b/lldb/source/DataFormatters/NSDictionary.cpp
@@ -44,11 +44,11 @@
             
             if (clang_type)
             {
-                ClangASTContext::StartTagDeclarationDefinition(clang_type);
+                clang_type.StartTagDeclarationDefinition();
                 ClangASTType id_clang_type = target_ast_context->GetBasicType (eBasicTypeObjCID);
-                ClangASTContext::AddFieldToRecordType(clang_type, "key", id_clang_type, lldb::eAccessPublic, 0);
-                ClangASTContext::AddFieldToRecordType(clang_type, "value", id_clang_type, lldb::eAccessPublic, 0);
-                ClangASTContext::CompleteTagDeclarationDefinition(clang_type);
+                clang_type.AddFieldToRecordType("key", id_clang_type, lldb::eAccessPublic, 0);
+                clang_type.AddFieldToRecordType("value", id_clang_type, lldb::eAccessPublic, 0);
+                clang_type.CompleteTagDeclarationDefinition();
             }
         }
     }
diff --git a/lldb/source/DataFormatters/NSIndexPath.cpp b/lldb/source/DataFormatters/NSIndexPath.cpp
index 363069f..6932211 100644
--- a/lldb/source/DataFormatters/NSIndexPath.cpp
+++ b/lldb/source/DataFormatters/NSIndexPath.cpp
@@ -49,10 +49,7 @@
     {
         m_impl.m_mode = Mode::Invalid;
         
-        TypeSystem* type_system = m_backend.GetClangType().GetTypeSystem();
-        if (!type_system)
-            return false;
-        m_ast_ctx = type_system->AsClangASTContext();
+        m_ast_ctx = ClangASTContext::GetASTContext(m_backend.GetClangType().GetASTContext());
         if (!m_ast_ctx)
             return false;
         
diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp
index 1d6fc66..57bf696 100644
--- a/lldb/source/DataFormatters/VectorType.cpp
+++ b/lldb/source/DataFormatters/VectorType.cpp
@@ -231,7 +231,7 @@
                 ClangASTType parent_type(m_backend.GetClangType());
                 ClangASTType element_type;
                 parent_type.IsVectorType(&element_type, nullptr);
-                m_child_type = ::GetClangTypeForFormat(m_parent_format, element_type, parent_type.GetTypeSystem()->AsClangASTContext());
+                m_child_type = ::GetClangTypeForFormat(m_parent_format, element_type, ClangASTContext::GetASTContext(parent_type.GetASTContext()));
                 m_num_children = ::CalculateNumChildren(parent_type,
                                                         m_child_type);
                 m_item_format = GetItemFormatForFormat(m_parent_format,