[cfe-dev] Get "real" type name.
Guillaume Maudoux (Layus) via cfe-dev
cfe-dev at lists.llvm.org
Mon Jan 25 08:15:32 PST 2016
Hi,
I am currently fighting with clang libs to get the "real" type name of a
template parameter.
My current code obtains the "resolved" name of the type.
For example, with a `typedef int myInt;`,
templateArgs[0].getAsType().getAsString() returns "int" instead of "myInt".
const TemplateArgumentList& templateArgs = specDecl->getTemplateArgs();
assert(templateArgs.size() == 1);
assert(templateArgs[0].getKind() == TemplateArgument::Type);
return
templateArgs[0].getAsType().getAsString(context->getPrintingPolicy());
Is there some way to extract the type string used in the source code,
not the type infered by clang ?
Thx,
Layus.
More information about the cfe-dev
mailing list