This is the meat of the code to add Clang modules
support to LLDB. It includes the following:
- Changed DeclVendor to TypeVendor.
- Made the ObjCLanguageRuntime provide a DeclVendor
rather than a TypeVendor.
- Changed the consumers of TypeVendors to use
DeclVendors instead.
- Provided a few convenience functions on
ClangASTContext to make that easier.
llvm-svn: 223433
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 15027fb..5db40a0 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1132,6 +1132,16 @@
return ast->hasSameType (type1_qual, type2_qual);
}
+ClangASTType
+ClangASTContext::GetTypeForDecl (clang::NamedDecl *decl)
+{
+ if (clang::ObjCInterfaceDecl *interface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl))
+ return GetTypeForDecl(interface_decl);
+ if (clang::TagDecl *tag_decl = llvm::dyn_cast<clang::TagDecl>(decl))
+ return GetTypeForDecl(tag_decl);
+ return ClangASTType();
+}
+
ClangASTType
ClangASTContext::GetTypeForDecl (TagDecl *decl)
@@ -1139,7 +1149,7 @@
// No need to call the getASTContext() accessor (which can create the AST
// if it isn't created yet, because we can't have created a decl in this
// AST if our AST didn't already exist...
- ASTContext *ast = m_ast_ap.get();
+ ASTContext *ast = &decl->getASTContext();
if (ast)
return ClangASTType (ast, ast->getTagDeclType(decl).getAsOpaquePtr());
return ClangASTType();
@@ -1151,7 +1161,7 @@
// No need to call the getASTContext() accessor (which can create the AST
// if it isn't created yet, because we can't have created a decl in this
// AST if our AST didn't already exist...
- ASTContext *ast = m_ast_ap.get();
+ ASTContext *ast = &decl->getASTContext();
if (ast)
return ClangASTType (ast, ast->getObjCInterfaceType(decl).getAsOpaquePtr());
return ClangASTType();