DeclContext::lookup() on a FunctionDecl

I want to find a declaration of a struct that’s declared in the body of a FunctionDecl. The code looks like this:

DeclarationName struct_name(&m_ast_context->Idents.get(m_struct_name.c_str()));
FunctionDecl::lookup_result struct_lookup = F->lookup(struct_name);

When I call lookup() here, LookupPtr.getPointer() for the FunctionDecl is NULL and LookupPtr.getInt() is also NULL, so lookup() returns lookup_result(lookup_iterator(0), lookup_iterator(0)) without regard to what name I pass in.

Is there something wrong with this FunctionDecl, or is this expected behavior for FunctionDecls?

Sean

This is expected behavior. Lookup into FunctionDecls is not especially meaningful, since there can be nested scopes within the function which are not modeled by the lookup. For performance, we do not generally build the lookup data structures for function declarations.