[cfe-dev] a question regarding clang::Type::isFunctionPointerType()

Erik Pilkington via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 9 15:15:01 PST 2016


Well, only the first is a pointer to a function, the others are pointers to pointers to functions. I guess you probably would want to drill down through the type, using PointerType::getPointeeType() until you reach the function pointer, then check to see if that is a pointer to a function.
- Erik

> On Dec 9, 2016, at 5:44 PM, Farzad Sadeghi via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> i have these four function pointer types:
> 	int ** (*pfunc1)();
> 	int ** (**pfunc2)();
> 	int ** (***pfunc3)();
> 	int *** (**pfunc4)();
> when i use isFunctionPointerType() on them, only the first declaration
> is recognized as a function pointer.
> I'm using C90 and the clang::Type is from a QualType acquired from
> QualType::getCanonicalType(). i get the same behavior from a
> clang::Type that was acquired from a VarDecl::getType().
> Obviouly my getting the wrong QualType and/or clang::Type. which one
> should i e getting so that all four of these declarations are
> recognized as function pointers?
> 
> 
> -- 
> Farzad Sadeghi
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list