Final bit of type system cleanup that abstracts declaration contexts into lldb_private::CompilerDeclContext and renames ClangType to CompilerType in many accessors and functions.

Create a new "lldb_private::CompilerDeclContext" class that will replace all direct uses of "clang::DeclContext" when used in compiler agnostic code, yet still allow for conversion to clang::DeclContext subclasses by clang specific code. This completes the abstraction of type parsing by removing all "clang::" references from the SymbolFileDWARF. The new "lldb_private::CompilerDeclContext" class abstracts decl contexts found in compiler type systems so they can be used in internal API calls. The TypeSystem is required to support CompilerDeclContexts with new pure virtual functions that start with "DeclContext" in the member function names. Converted all code that used lldb_private::ClangNamespaceDecl over to use the new CompilerDeclContext class and removed the ClangNamespaceDecl.cpp and ClangNamespaceDecl.h files.

Removed direct use of clang APIs from SBType and now use the abstract type systems to correctly explore types.

Bulk renames for things that used to return a ClangASTType which is now CompilerType:

    "Type::GetClangFullType()" to "Type::GetFullCompilerType()"
    "Type::GetClangLayoutType()" to "Type::GetLayoutCompilerType()"
    "Type::GetClangForwardType()" to "Type::GetForwardCompilerType()"
    "Value::GetClangType()" to "Value::GetCompilerType()"
    "Value::SetClangType (const CompilerType &)" to "Value::SetCompilerType (const CompilerType &)"
    "ValueObject::GetClangType ()" to "ValueObject::GetCompilerType()"
    many more renames that are similar.

llvm-svn: 245905
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 0c089f5..ed2a0a7 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -14,10 +14,10 @@
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Stream.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Type.h"
 
+#include "llvm/ADT/APSInt.h"
 #include "clang/AST/Decl.h"
 
 using namespace lldb;
@@ -343,12 +343,7 @@
 SBType::GetBasicType(lldb::BasicType basic_type)
 {
     if (IsValid() && m_opaque_sp->IsValid())
-    {
-        ClangASTContext* ast = m_opaque_sp->GetTypeSystem(false)->AsClangASTContext();
-        if (ast)
-            return SBType (ClangASTContext::GetBasicType (ast->getASTContext(), basic_type));
-    }
-    
+        return SBType(m_opaque_sp->GetTypeSystem(false)->GetBasicTypeFromAST(basic_type));
     return SBType();
 }
 
@@ -356,7 +351,7 @@
 SBType::GetNumberOfDirectBaseClasses ()
 {
     if (IsValid())
-        return ClangASTContext::GetNumDirectBaseClasses(m_opaque_sp->GetCompilerType(true));
+        return m_opaque_sp->GetCompilerType(true).GetNumDirectBaseClasses();
     return 0;
 }
 
@@ -364,7 +359,7 @@
 SBType::GetNumberOfVirtualBaseClasses ()
 {
     if (IsValid())
-        return ClangASTContext::GetNumVirtualBaseClasses(m_opaque_sp->GetCompilerType(true));
+        return m_opaque_sp->GetCompilerType(true).GetNumVirtualBaseClasses();
     return 0;
 }
 
@@ -399,16 +394,10 @@
     SBTypeMember sb_type_member;
     if (IsValid())
     {
-        CompilerType this_type (m_opaque_sp->GetCompilerType (true));
-        if (this_type.IsValid())
-        {
-            uint32_t bit_offset = 0;
-            CompilerType base_class_type (ClangASTContext::GetDirectBaseClassAtIndex(this_type, idx, &bit_offset));
-            if (base_class_type.IsValid())
-            {
-                sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
-            }
-        }
+        uint32_t bit_offset = 0;
+        CompilerType base_class_type = m_opaque_sp->GetCompilerType (true).GetDirectBaseClassAtIndex(idx, &bit_offset);
+        if (base_class_type.IsValid())
+            sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
     }
     return sb_type_member;
 
@@ -420,16 +409,10 @@
     SBTypeMember sb_type_member;
     if (IsValid())
     {
-        CompilerType this_type (m_opaque_sp->GetCompilerType (true));
-        if (this_type.IsValid())
-        {
-            uint32_t bit_offset = 0;
-            CompilerType base_class_type (ClangASTContext::GetVirtualBaseClassAtIndex(this_type, idx, &bit_offset));
-            if (base_class_type.IsValid())
-            {
-                sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
-            }
-        }
+        uint32_t bit_offset = 0;
+        CompilerType base_class_type = m_opaque_sp->GetCompilerType (true).GetVirtualBaseClassAtIndex(idx, &bit_offset);
+        if (base_class_type.IsValid())
+            sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
     }
     return sb_type_member;
 }
@@ -440,16 +423,14 @@
     SBTypeEnumMemberList sb_enum_member_list;
     if (IsValid())
     {
-        const clang::EnumDecl *enum_decl = ClangASTContext::GetAsEnumDecl(m_opaque_sp->GetCompilerType(true).GetFullyUnqualifiedType());
-        if (enum_decl)
+        CompilerType this_type (m_opaque_sp->GetCompilerType (true));
+        if (this_type.IsValid())
         {
-            clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
-            for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
-            {
-                SBTypeEnumMember enum_member;
-                enum_member.reset(new TypeEnumMemberImpl(*enum_pos, CompilerType(m_opaque_sp->GetTypeSystem(true), enum_decl->getIntegerType().getAsOpaquePtr())));
+            this_type.ForEachEnumerator([&sb_enum_member_list] (const CompilerType &integer_type, const ConstString &name, const llvm::APSInt &value) -> bool {
+                SBTypeEnumMember enum_member (lldb::TypeEnumMemberImplSP (new TypeEnumMemberImpl(lldb::TypeImplSP(new TypeImpl(integer_type)), name, value)));
                 sb_enum_member_list.Append(enum_member);
-            }
+                return true; // Keep iterating
+            });
         }
     }
     return sb_enum_member_list;
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index cd5ba67..e44488a 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -1319,7 +1319,7 @@
     ValueLocker locker;
     lldb::ValueObjectSP value_sp(GetSP(locker));
     if (value_sp)
-        return value_sp->GetClangType().GetOpaqueQualType();
+        return value_sp->GetCompilerType().GetOpaqueQualType();
     return NULL;
 }
 
@@ -1812,7 +1812,7 @@
             watch_type |= LLDB_WATCH_TYPE_WRITE;
 
         Error rc;
-        CompilerType type (value_sp->GetClangType());
+        CompilerType type (value_sp->GetCompilerType());
         WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
         error.SetError(rc);