[Lldb-commits] [lldb] 82800df - [lldb][NFC] Remove ClangASTContext::GetAsDeclContext
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 20 03:28:36 PST 2019
Author: Raphael Isemann
Date: 2019-11-20T12:28:16+01:00
New Revision: 82800df4de1bfc5fc332fc60f399d50c444050fe
URL: https://github.com/llvm/llvm-project/commit/82800df4de1bfc5fc332fc60f399d50c444050fe
DIFF: https://github.com/llvm/llvm-project/commit/82800df4de1bfc5fc332fc60f399d50c444050fe.diff
LOG: [lldb][NFC] Remove ClangASTContext::GetAsDeclContext
Everything we pass to this function is already a DeclContext.
Added:
Modified:
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Symbol/ClangASTContext.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index 38047583412e..e68df0a4868a 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -308,10 +308,7 @@ class ClangASTContext : public TypeSystem {
class_template_specialization_decl);
static clang::DeclContext *
- GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl);
-
- static clang::DeclContext *
- GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl);
+ GetAsDeclContext(clang::FunctionDecl *function_decl);
static bool CheckOverloadedOperatorKindParameterCount(
bool is_method, clang::OverloadedOperatorKind op_kind,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 24b9e75d03e4..cacb62aa2f15 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -894,8 +894,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
attrs.accessibility, attrs.is_artificial, is_variadic);
type_handled = objc_method_decl != NULL;
if (type_handled) {
- LinkDeclContextToDIE(
- ClangASTContext::GetAsDeclContext(objc_method_decl), die);
+ LinkDeclContextToDIE(objc_method_decl, die);
m_ast.SetMetadataAsUserID(objc_method_decl, die.GetID());
} else {
dwarf->GetObjectFile()->GetModule()->ReportError(
@@ -1009,10 +1008,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
if (method_decl->getType() ==
ClangUtil::GetQualType(clang_type)) {
add_method = false;
- LinkDeclContextToDIE(
- ClangASTContext::GetAsDeclContext(
- method_decl),
- die);
+ LinkDeclContextToDIE(method_decl, die);
type_handled = true;
break;
@@ -1054,9 +1050,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
type_handled |= attrs.is_artificial;
if (cxx_method_decl) {
- LinkDeclContextToDIE(
- ClangASTContext::GetAsDeclContext(cxx_method_decl),
- die);
+ LinkDeclContextToDIE(cxx_method_decl, die);
ClangASTMetadata metadata;
metadata.SetUserID(die.GetID());
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 12b49618366c..fbf5bd4cf406 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -2487,16 +2487,6 @@ ClangASTMetadata *ClangASTContext::GetMetadata(clang::ASTContext *ast,
return nullptr;
}
-clang::DeclContext *
-ClangASTContext::GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl) {
- return llvm::dyn_cast<clang::DeclContext>(cxx_method_decl);
-}
-
-clang::DeclContext *
-ClangASTContext::GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl) {
- return llvm::dyn_cast<clang::DeclContext>(objc_method_decl);
-}
-
bool ClangASTContext::SetTagTypeKind(clang::QualType tag_qual_type,
int kind) const {
const clang::Type *clang_type = tag_qual_type.getTypePtr();
More information about the lldb-commits
mailing list