[cfe-dev] problem with the new AnnotateAttr

Sean Hunt rideau3 at gmail.com
Fri Aug 20 11:17:02 PDT 2010


On 08/20/2010 08:00 AM, Jan Bierbaum wrote:
> Yesterday(?) the Attrs part of Clang was significantly changed and after
> the update I adapted my plugin to the changes. Unfortunately it doesn't
> work any more. Either I'm using the new infrastructure in a wrong way or
> it's buggy.
>
> Attached to this mail are two files
>
> Consumer.cpp => HandleTranslationUnit method to demonstrate the issue
> test.cpp     => small source for the demonstration


> 			dyn_cast<clang::AnnotateAttr>(attr)) {

Dereferencing the attr on this line should solve it. It seems there's a 
bug in dyn_cast for multi-level pointers - isa works on them and then 
cast does not, so you get garbage back.

Also, you may want to look at the new specific_attr_iterator interface, 
which does the downcasting automatically.

Sean



More information about the cfe-dev mailing list