[cfe-dev] Recover TypeDecl* from QualType

Victor Vicente de Carvalho victor.v.carvalho at gmail.com
Sun Jul 7 14:42:59 PDT 2013


2013/7/7 Eli Friedman <eli.friedman at gmail.com>

> On Sun, Jul 7, 2013 at 10:14 AM, Victor Vicente de Carvalho
> <victor.v.carvalho at gmail.com> wrote:
> > Thanks Eli, so It's just a matter of dyn_cast the Type* to RecordType*?
>
> Yes... except that you generally want to use the getAs() method of
> Type rather than dyn_cast because getAs automatically looks through
> sugar like typedefs.
>
> > Another question, what's the best way to detect is a Type has atemplate
> > parameters?
>
> Depends on what exactly you mean by "has template parameters"... but
> CXXRecordDecl::getDescribedClassTemplate might be helpful.
>
>
Calling getDescribedClassTemplate on a CXXRecordDecl* for a
std::shared_ptr<X> returns null, and getNumTemplateParameterLists is
returning zero too. The compilation is fine, tough, so it's not a missing
include.



> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130707/98ac81c4/attachment.html>


More information about the cfe-dev mailing list