[Symbol] Decouple clang from DeclVendor

Summary:
This removes DeclVendor's dependency on clang (and ClangASTContext).
DeclVendor has no need to know about specific TypeSystems.

Differential Revision: https://reviews.llvm.org/D66628

llvm-svn: 369735
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index faeaf78..3670084 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1473,6 +1473,16 @@
   return ast->getASTContext()->hasSameType(type1_qual, type2_qual);
 }
 
+CompilerType ClangASTContext::GetTypeForDecl(void *opaque_decl) {
+  if (!opaque_decl)
+    return CompilerType();
+
+  clang::Decl *decl = static_cast<clang::Decl *>(opaque_decl);
+  if (auto *named_decl = llvm::dyn_cast<clang::NamedDecl>(decl))
+    return GetTypeForDecl(named_decl);
+  return CompilerType();
+}
+
 CompilerType ClangASTContext::GetTypeForDecl(clang::NamedDecl *decl) {
   if (clang::ObjCInterfaceDecl *interface_decl =
           llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl))
diff --git a/lldb/source/Symbol/DeclVendor.cpp b/lldb/source/Symbol/DeclVendor.cpp
index 0a912a2..9ccf422 100644
--- a/lldb/source/Symbol/DeclVendor.cpp
+++ b/lldb/source/Symbol/DeclVendor.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Symbol/DeclVendor.h"
-
-#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/TypeSystem.h"
 
 #include <vector>
 
@@ -20,10 +20,11 @@
   // FIXME: This depends on clang, but should be able to support any
   // TypeSystem.
   std::vector<CompilerType> ret;
-  std::vector<clang::NamedDecl *> decls;
+  std::vector<CompilerDecl> decls;
   if (FindDecls(name, /*append*/ true, max_matches, decls))
-    for (auto *decl : decls)
-      if (auto type = ClangASTContext::GetTypeForDecl(decl))
+    for (auto decl : decls)
+      if (auto type =
+              decl.GetTypeSystem()->GetTypeForDecl(decl.GetOpaqueDecl()))
         ret.push_back(type);
   return ret;
 }