<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 5, 2011, at 4:22 AM, variadic.template wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>I try to transform some objective-c-code to Java. For this,<br>i subclassed the RecursiveASTVisitor, visit the decls/<br>statements and transform them.<br>To see the structure of the code as clang it sees, i first<br>print every declaration and statement with their<br>corresponding sourcerange. Thus, i can see that a "normal"<br>function-declaration (FunctionDecl), that is located somewhere<br>between the objective-c code, will be not visited until all<br>the other objective-c-method-declarations (ObjCMethodDecl)<br>have been visited - effectively it seems as clang jumps back<br>inside the sourcecode.<br>Is this the wanted behavior and when yes, why?<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>This is a bug. Objective-C's ASTs are still a bit messy w.r.t. the ordering of declarations. libclang has a few hacks to work around the issues, but in the long term, we want to fix the ASTs themselves rather than hack up the visitor.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div></body></html>