[cfe-dev] typedef, TagType & isDefinition() bug.

Paolo Bolzoni bolzoni at cs.unipr.it
Tue Dec 23 12:33:48 PST 2008


Code example:
---->
struct A;
typedef struct A B;
struct A { int a; };
----<

The second declaration is of type clang::TypeDecl,
using getUnderlyingType() I obtain the clang::QualType of the struct A.

getTypePtr() gives me the clang::RecordType.

But to know the name of the referenced struct (the `A') I need to use
getDecl().

getDecl() returns a pointer to the declaration, but this clang::RecordDecl's
isDefinition() member function returns true. I think this is a bug.

If not, how can I distinguish from this:
---->
struct A;
typedef struct A B;
struct A { int a; };
----<

to this?
---->
struct A;
typedef struct A { int a; } B;
----<

Thanks.
pb



More information about the cfe-dev mailing list