[cfe-dev] renaming a Type

John McCall rjmccall at apple.com
Fri Aug 27 18:19:24 PDT 2010


On Aug 27, 2010, at 3:48 PM, Vladimir Kirillov wrote:

> On 10:03 Fri 27 Aug, John McCall wrote:
>> On Aug 27, 2010, at 4:40 AM, Vladimir Kirillov wrote:
>>> 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.
>> 
>> 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
> IdentifierInfo::setName()?

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).

John.



More information about the cfe-dev mailing list