renaming a Type

Hello, cfe-dev!

I'm using a clang to index the types used all over the code.
I'm having a custom anonymous types naming scheme used in the code,
so I want to rename the anonymous types to conform that scheme.

For instance, consider the following type:
struct parent::<anonymous at tests/a.c:4:2>

I want to rename the <anonymous ...> part (actually let the type
identifier have something in it's name field).

I took a brief look into the IdentifierInfo and TypePrinter,
but the IdentifierInfo::getNameStart() method uses some weird
identifier lookups, so i'm asking for help here.

Please, explain me how to do it the best way :-).


The ASTContext has a reference to the IdentifierTable, which has
IdentifierTable::get(...). I think that's what you're looking for.


Right. Assuming I have looked up the type's IdentifierInfo, how to
change the name of this type in a proper way? Is there anything like

An IdentifierInfo *is* a name. You need the set the name of the TypeDecl,
which you do by calling setDeclName with a different IdentifierInfo (or to
be precise, with a DeclarationName based on a different IdentifierInfo).