[cfe-dev] Recovering the unqualified class name from a function parameter
Victor Vicente de Carvalho
victor.v.carvalho at gmail.com
Fri Nov 2 17:32:15 PDT 2012
This did the trick:
pp.SuppressTagKeyword = true;
std::string str =
2012/11/2 Victor Vicente de Carvalho <victor.v.carvalho at gmail.com>
> That managed to remove the const and the reference type, but when I try to
> use the "getAsString" method it returns to me "class Type". I could
> manually remove the "class " part, just to know if there is a way to do in
> a non hackish way.
> 2012/11/2 Eli Friedman <eli.friedman at gmail.com>
>> On Fri, Nov 2, 2012 at 2:45 PM, Victor Vicente de Carvalho
>> <victor.v.carvalho at gmail.com> wrote:
>> > Hello,
>> > I'm trying without success to recover the unqualified name for a type
>> > parsing a CXXMethodDecl. The first problem is that the Type class
>> > have a getNameAsString, or getAsString. The second problem is that even
>> > getting the unqualified type and dumping it still resolves to qualified
>> > types.
>> > Suppose I have a parameter on a function named as "const ClassType& x":
>> > all of those:
>> > (*param)->getType()->getUnqualifiedDesugaredType()->dump();
>> > (*param)->getType().getUnqualifiedType()->dump();
>> > (*param)->getType()->dump();
>> > returns const ClassType &identifier when dumping.
>> Try (*param)->getType().getNonReferenceType().getUnqualifiedType().dump()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev