r181093 - Added a function to check whether a Decl is in

Argyrios Kyrtzidis kyrtzidis at apple.com
Tue May 7 09:48:15 PDT 2013


Hi Sean,

On May 3, 2013, at 7:04 PM, Sean Callanan <scallanan at apple.com> wrote:

> Author: spyffe
> Date: Fri May  3 21:04:27 2013
> New Revision: 181093
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=181093&view=rev
> Log:
> 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.
> 

[...]

> +bool DeclContext::containsDecl(Decl *D) const {
> +  return (D->getLexicalDeclContext() == this &&
> +          (D->NextInContextAndBits.getPointer() || D == LastDecl));
> +}
> +

This seems weird to me; "containsDecl is true if the Decl is lexically in the DeclContext and the Decl participates in a Decl chain" ?
When would be the case that the Decl is lexically in the DeclContext without getting added to the lexical decl chain, and why would that be correct and not a bug ?



More information about the cfe-commits mailing list