[Lldb-commits] [lldb] c2dd84e - [lldb][NFC] Remove CompilerDeclContext::IsClang
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 28 06:54:37 PST 2019
Author: Raphael Isemann
Date: 2019-11-28T15:54:11+01:00
New Revision: c2dd84e396d091ca61b06b59c622b444ffc17234
URL: https://github.com/llvm/llvm-project/commit/c2dd84e396d091ca61b06b59c622b444ffc17234
DIFF: https://github.com/llvm/llvm-project/commit/c2dd84e396d091ca61b06b59c622b444ffc17234.diff
LOG: [lldb][NFC] Remove CompilerDeclContext::IsClang
This method is only used in ClangASTContext.
Also removes the includes we only needed for the ClangASTContext RTTI check
in the CompilerDecl[Context].cpp files.
Added:
Modified:
lldb/include/lldb/Symbol/CompilerDeclContext.h
lldb/source/Symbol/ClangASTContext.cpp
lldb/source/Symbol/CompilerDecl.cpp
lldb/source/Symbol/CompilerDeclContext.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index c140a3df13d0..fe8539ab30e6 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -38,8 +38,6 @@ class CompilerDeclContext {
return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
}
- bool IsClang() const;
-
std::vector<CompilerDecl> FindDeclByName(ConstString name,
const bool ignore_using_decls);
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index e413029f0300..e70b005550d1 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -10199,16 +10199,20 @@ bool ClangASTContext::DeclContextIsContainedInLookup(
return false;
}
+static bool IsClangDeclContext(const CompilerDeclContext &dc) {
+ return dc.IsValid() && isa<ClangASTContext>(dc.GetTypeSystem());
+}
+
clang::DeclContext *
ClangASTContext::DeclContextGetAsDeclContext(const CompilerDeclContext &dc) {
- if (dc.IsClang())
+ if (IsClangDeclContext(dc))
return (clang::DeclContext *)dc.GetOpaqueDeclContext();
return nullptr;
}
ObjCMethodDecl *
ClangASTContext::DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc) {
- if (dc.IsClang())
+ if (IsClangDeclContext(dc))
return llvm::dyn_cast<clang::ObjCMethodDecl>(
(clang::DeclContext *)dc.GetOpaqueDeclContext());
return nullptr;
@@ -10216,7 +10220,7 @@ ClangASTContext::DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc) {
CXXMethodDecl *
ClangASTContext::DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc) {
- if (dc.IsClang())
+ if (IsClangDeclContext(dc))
return llvm::dyn_cast<clang::CXXMethodDecl>(
(clang::DeclContext *)dc.GetOpaqueDeclContext());
return nullptr;
@@ -10224,7 +10228,7 @@ ClangASTContext::DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc) {
clang::FunctionDecl *
ClangASTContext::DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc) {
- if (dc.IsClang())
+ if (IsClangDeclContext(dc))
return llvm::dyn_cast<clang::FunctionDecl>(
(clang::DeclContext *)dc.GetOpaqueDeclContext());
return nullptr;
@@ -10232,7 +10236,7 @@ ClangASTContext::DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc) {
clang::NamespaceDecl *
ClangASTContext::DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc) {
- if (dc.IsClang())
+ if (IsClangDeclContext(dc))
return llvm::dyn_cast<clang::NamespaceDecl>(
(clang::DeclContext *)dc.GetOpaqueDeclContext());
return nullptr;
diff --git a/lldb/source/Symbol/CompilerDecl.cpp b/lldb/source/Symbol/CompilerDecl.cpp
index 017e541bd203..48d9169c1a7a 100644
--- a/lldb/source/Symbol/CompilerDecl.cpp
+++ b/lldb/source/Symbol/CompilerDecl.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/CompilerDecl.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompilerDeclContext.h"
#include "lldb/Symbol/TypeSystem.h"
diff --git a/lldb/source/Symbol/CompilerDeclContext.cpp b/lldb/source/Symbol/CompilerDeclContext.cpp
index 7d45f47ad133..672de6ec34d1 100644
--- a/lldb/source/Symbol/CompilerDeclContext.cpp
+++ b/lldb/source/Symbol/CompilerDeclContext.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/CompilerDeclContext.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/TypeSystem.h"
#include <vector>
@@ -24,10 +23,6 @@ CompilerDeclContext::FindDeclByName(ConstString name,
return std::vector<CompilerDecl>();
}
-bool CompilerDeclContext::IsClang() const {
- return IsValid() && llvm::isa<ClangASTContext>(m_type_system);
-}
-
ConstString CompilerDeclContext::GetName() const {
if (IsValid())
return m_type_system->DeclContextGetName(m_opaque_decl_ctx);
More information about the lldb-commits
mailing list