<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 12, 2014 at 2:41 PM, Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>Given a Decl*, I want to find who are the other decls in its DeclGroup. So for:</div>
<div><br></div><div> int foo, bar;</div><div><br></div><div>Given a Decl* for 'foo', I want to find 'bar'.</div>
<div><br></div><div>ASTConsumer.h (<a href="http://clang.llvm.org/doxygen/ASTConsumer_8h_source.html" target="_blank">http://clang.llvm.org/doxygen/ASTConsumer_8h_source.html</a>) mentions a getNextDeclarator method, which seems to have been removed in r68002 (so the comment is stale now).</div>
<div><br></div><div>Any way to do this?</div><div><br></div><div>One way I see is when the consumer defines HandleTopLevelDecl it gets the whole group and can go over it. But what about somewhere deep in the traversal, if all I have is a Decl*?</div>
<div><br></div><div>There's getNextDeclInContext, but that goes beyond the group too.</div></div></blockquote><div><br></div><div>I don't believe we have any explicit representation of top-level DeclGroups once we finish parsing. You may be able to reconstruct this information by looking at the source locations of declarations (if the source range of the next declaration in the lexical context overlaps the current declaration's range, then they're in the same group).</div>
</div></div></div>