[cfe-dev] How can I get the template argument in a TypedefDecl ?
Yaron Keren
yaron.keren at gmail.com
Tue Aug 5 08:05:31 PDT 2014
Hi,
Try this:
std::string getTypeName(QualType QT) {
std::string TypeName;
llvm::raw_string_ostream TypeNameOS(TypeName);
LangOptions LO;
QT.print(TypeNameOS, PrintingPolicy(LO), "identifier");
TypeNameOS.flush();
return TypeName;
}
Yaron
2014-08-05 17:53 GMT+03:00 Manasij Mukherjee <manasij7479 at gmail.com>:
> Hi,
> For the following code:
> template <typename T>
> class A {
>
> };
> class B {};
>
> typedef A<B> C;
>
> I need to access this 'B' template argument, as a Type pointer, maybe.
> (Ultimately, I only need its name as a string)
>
> Can anyone point me to the right way to get this information ?
>
> I can get a QualType for A<B> with the getTypeSourceInfo()->getType()
> functions.
> But what to do after that, I can not figure out.
>
> Manasij Mukherjee
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140805/198296b1/attachment.html>
More information about the cfe-dev
mailing list