[cfe-dev] sequence of visiting declarations/statements in RecursiveASTVisitor
Douglas Gregor
dgregor at apple.com
Wed Jan 5 07:07:25 PST 2011
On Jan 5, 2011, at 4:22 AM, variadic.template wrote:
> Hi,
>
> I try to transform some objective-c-code to Java. For this,
> i subclassed the RecursiveASTVisitor, visit the decls/
> statements and transform them.
> To see the structure of the code as clang it sees, i first
> print every declaration and statement with their
> corresponding sourcerange. Thus, i can see that a "normal"
> function-declaration (FunctionDecl), that is located somewhere
> between the objective-c code, will be not visited until all
> the other objective-c-method-declarations (ObjCMethodDecl)
> have been visited - effectively it seems as clang jumps back
> inside the sourcecode.
> Is this the wanted behavior and when yes, why?
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.
- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110105/0e9a0bdc/attachment.html>
More information about the cfe-dev
mailing list