[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))