<div class="gmail_quote">On Thu, Aug 9, 2012 at 3:29 PM, Sean Callanan <span dir="ltr"><<a href="mailto:scallanan@apple.com" target="_blank">scallanan@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">I want to find a declaration of a struct that's declared in the body of a FunctionDecl.  The code looks like this:<div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">
DeclarationName struct_name(&m_ast_context->Idents.get(m_struct_name.c_str()));</div><div style="margin:0px;font-size:11px;font-family:Menlo">FunctionDecl::lookup_result struct_lookup = F->lookup(struct_name);</div>
<div><br></div></div><div>When I call <span style="font-family:Menlo;font-size:11px">lookup()</span> here, <span style="font-family:Menlo;font-size:11px">LookupPtr.getPointer()</span> for the FunctionDecl is NULL and <span style="font-family:Menlo;font-size:11px">LookupPtr.getInt()</span> is also NULL, so <span style="font-family:Menlo;font-size:11px">lookup()</span> returns <span style="font-family:Menlo;font-size:11px">lookup_result(lookup_iterator(</span><span style="font-family:Menlo;font-size:11px">0</span><span style="font-family:Menlo;font-size:11px">), lookup_iterator(</span><span style="font-family:Menlo;font-size:11px">0</span><span style="font-family:Menlo;font-size:11px">))</span> without regard to what name I pass in.</div>
<div><br></div><div>Is there something wrong with this FunctionDecl, or is this expected behavior for FunctionDecls?</div></div></blockquote><div><br></div><div>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.</div>
</div>