aboutsummaryrefslogtreecommitdiff
path: root/lib/AST
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-05-04 02:04:27 +0000
committerSean Callanan <scallanan@apple.com>2013-05-04 02:04:27 +0000
commitcd904e8864637e427f5ea3bf35a26e79b3dbbadf (patch)
tree92717dfb288bb3edda2ac33e8bc06519f6ae95ea /lib/AST
parentdf6217ec356f1e8f440ea7222be3603c011a295d (diff)
Added a function to check whether a Decl is in
the list of Decls for a given DeclContext. This is useful for LLDB's implementation of FindExternalLexicalDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r--lib/AST/DeclBase.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index c1fbdb996d..7b7900640b 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -1064,6 +1064,11 @@ bool DeclContext::decls_empty() const {
return !FirstDecl;
}
+bool DeclContext::containsDecl(Decl *D) const {
+ return (D->getLexicalDeclContext() == this &&
+ (D->NextInContextAndBits.getPointer() || D == LastDecl));
+}
+
void DeclContext::removeDecl(Decl *D) {
assert(D->getLexicalDeclContext() == this &&
"decl being removed from non-lexical context");