<div dir="ltr">Attributes are not reflected in the canonical type. They may only appear on the fully-sugared type, which isn't always available. Some attributes, like calling convention attributes, noreturn, regparm, and some other misc things, are embedded in the canonical FunctionProtoType, but this is only implemented on a case-by-case basis as required by overload resolution and other language extension rules.<div><br></div><div>I think your best path forward is to embed the attributes you care about in FunctionProtoType::ExtProtoInfo.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 2, 2017 at 7:05 AM, Marc-AndrĂ© Lureau via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>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.<br><br>I have started adding some code around Sema::<wbr>CheckSingleAssignmentConstrain<wbr>ts. 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?<br><br></div>thanks a lot<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marc-AndrĂ© Lureau<br></div></div>
</font></span><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>