[cfe-dev] Check assignment attributes compatibility

Marc-André Lureau via cfe-dev cfe-dev at lists.llvm.org
Sun Jul 2 07:05:09 PDT 2017


Hi,

I am new to clang development, and I would like to have some warnings if an
assignment of function pointer doesn't match the LHS attributes: void
__attribute__((Attrs)) (*func)() = foo should warn if foo doesn't have
Attrs.

I have started adding some code around
Sema::CheckSingleAssignmentConstraints. I can get the attrs from the LHS,
LHSType.getTypePtr() / ->getAs<TypedefType>() if necessary / ->getDecl()
and use attribute getters. However, I have more trouble with the RHS for
some reason, RHS.get()->getType() is a FunctionProtoType. How can I get the
associated attributes from there?

thanks a lot
-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170702/3b3d9553/attachment.html>


More information about the cfe-dev mailing list