[cfe-dev] Recover TypeDecl* from QualType

Eli Friedman eli.friedman at gmail.com
Sun Jul 7 11:12:11 PDT 2013


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.

-Eli



More information about the cfe-dev mailing list