[cfe-dev] RecursiveASTVisitor: VisitTypeOfExprType doesn't get called
Sergejs Belajevs
sergejs.belajevs at gmail.com
Thu Aug 16 07:34:08 PDT 2012
Done: http://llvm.org/bugs/show_bug.cgi?id=13618
On Thu, Aug 16, 2012 at 4:50 PM, Manuel Klimek <klimek at google.com> wrote:
> On Thu, Aug 16, 2012 at 3:34 PM, Sergejs Belajevs
> <sergejs.belajevs at gmail.com> wrote:
>> Hi,
>>
>> I am using clang for a source-to-source transformation tool and as a
>> part of the whole process, I am using RecursiveASTVisitor for variable
>> renaming, specifically, VisitVarDecl and VisitDeclRefExpr. While
>> testing it on open-source project, found the following code:
>>
>> test.c:
>>
>> int status = 0;
>> ...
>> status = ((((__extension__ (((union { __typeof(status) __in; int __i;
>> }) { .__in = (status) }).__i))) & 0xff00) >> 8);
>>
>> Original code is compiled without errors (by C compiler), but not my
>> transformed code. The problem is that all occurrences of "status" are
>> renamed. All but one, which is inside "__typeof()" inside anonymous
>> union inside __extension__. I added also "VisitTypeOfExprType" to my
>> resursive AST visitor and it never got called on this code. However,
>> when I tried it on the following code:
>>
>> status = ({ union { __typeof(status) __in; int __i; } a; a.__in =
>> status; (a.__i & 0xff00) >> 8; });
>>
>> I got a call to VisitTypeOfExprType. All occurrences of status are
>> also correctly renamed by my transformation tool for this piece of
>> code.
>>
>> Can somebody help me to get my renaming working also for the first
>> case with "__extension__"? Am I doing something wrong or is this a
>> bug?
>
> Gut feeling would be that this is a bug in RAV, but I think that needs
> some more investigation. Please open a bug so we track it.
>
> Thanks for reporting,
> /Manuel
>
>
>
>>
>>
>> Thanks,
>> Sergejs
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list