[cfe-dev] CSA: How to get typedef type in specialization of template function?
Aleksandr via cfe-dev
cfe-dev at lists.llvm.org
Tue Sep 12 04:58:03 PDT 2017
Hello,
I can't receive typedef type from function template. For example, I have
such code for analyze:
//////cpp code////////////////////////
typedef float templatedTypedef;
template <typename TfT> void funcTempl(int a);
int testTemplatedTypedef() {
funcTempl<templatedTypedef>(10);
}
//////end code/////////////////////////
When I try to receive type of template parameter in this way:
//////cpp code////////////////////////
const FunctionDecl *FD = ... ; // Pointer to declaration funcTempl.
const TemplateArgumentList *TAL =
FD->getDescribedFunctionTemplate()->getTemplateSpecializationArgs();
for (const TemplateArgument &TA : TAL->asArray()) {
TA.dump(); // It print's that type is float.
}
//////end code/////////////////////////
So I see type, but this type is type of typedef, but I can get typedef
itself. I guess for template function it unpack type of typedef and
throw out it. Or maybe I can get this typedef in another way? can
anybody help me?
More information about the cfe-dev
mailing list