<div dir="ltr">I'm not sure if this is the right way to do it, but xxx->getAsType()->getAsCXXRecordDecl()->getName() should return just the class name. It's not generic and you have to protect yourself from getAsCXXRecordDecl returning nullptr.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 18, 2015 at 2:45 AM, Han Wang <span dir="ltr"><<a href="mailto:wanghan02@gmail.com" target="_blank">wanghan02@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>Let's say we have code like this,</div><div><br></div><div>class MyClass {};</div><div>vector<MyClass> a;</div><div><br></div><div>I would like to get MyClass out as a string. We could use this matcher to get the TemplateArgument. </div><div><br></div><div>varDecl(hasType(classTemplateSpecializationDecl(hasTemplateArgument(0, templateArgument().bind("TemplateType")))))<br></div><div><br></div><div>We could also use xxx->getAsType().getAsString() to get the type string. But the thing is I can only get the type "class MyClass". How can I get only "MyClass" without "class"? </div><div><br></div><div>Thanks!</div><div>Best regards,</div><div>Han</div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>