diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-12-29 23:01:53 +0100 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-12-30 00:22:23 +0100 |
commit | b1fb07ddbaa539f9173e32dc27110168b165c1fe (patch) | |
tree | c78dbe24e774121055411bdb52830fcd105a1c0d /lldb/source/Symbol/ClangASTContext.cpp | |
parent | 6991d5728f12594cabfd8d8d570361efb07f1d5a (diff) | |
download | bcm5719-llvm-b1fb07ddbaa539f9173e32dc27110168b165c1fe.tar.gz bcm5719-llvm-b1fb07ddbaa539f9173e32dc27110168b165c1fe.zip |
[lldb][NFC] Simplify ClangASTContext::GetTypeForDecl
Also removes the GetASTContext call from this code.
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
-rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index e9727399d7e..d226a34b1ac 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -1179,25 +1179,13 @@ CompilerType ClangASTContext::GetTypeForDecl(clang::NamedDecl *decl) { } CompilerType ClangASTContext::GetTypeForDecl(TagDecl *decl) { - // 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 = &decl->getASTContext(); - if (ast) - return CompilerType(ClangASTContext::GetASTContext(ast), - ast->getTagDeclType(decl).getAsOpaquePtr()); - return CompilerType(); + return CompilerType(this, + getASTContext().getTagDeclType(decl).getAsOpaquePtr()); } CompilerType ClangASTContext::GetTypeForDecl(ObjCInterfaceDecl *decl) { - // 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 = &decl->getASTContext(); - if (ast) - return CompilerType(ClangASTContext::GetASTContext(ast), - ast->getObjCInterfaceType(decl).getAsOpaquePtr()); - return CompilerType(); + return CompilerType( + this, getASTContext().getObjCInterfaceType(decl).getAsOpaquePtr()); } #pragma mark Structure, Unions, Classes @@ -9183,7 +9171,7 @@ uint32_t ClangASTContext::CountDeclLevels(clang::DeclContext *frame_decl_ctx, continue; // Check types, if one was provided. if (child_type) { - CompilerType clang_type = ClangASTContext::GetTypeForDecl(nd); + CompilerType clang_type = GetTypeForDecl(nd); if (!AreTypesSame(clang_type, *child_type, /*ignore_qualifiers=*/true)) continue; |