forked from OSchip/llvm-project
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. llvm-svn: 181093
This commit is contained in:
parent
b875c43307
commit
0325fb8576
|
@ -1412,6 +1412,9 @@ public:
|
|||
|
||||
/// @brief Removes a declaration from this context.
|
||||
void removeDecl(Decl *D);
|
||||
|
||||
/// @brief Checks whether a declaration is in this context.
|
||||
bool containsDecl(Decl *D) const;
|
||||
|
||||
/// lookup_iterator - An iterator that provides access to the results
|
||||
/// of looking up a name within this context.
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue