<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 27, 2013, at 6:55 , Richard <<a href="mailto:tarka.t.otter@gmail.com">tarka.t.otter@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>On 25 Oct 2013, at 18:51, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br>+        const ObjCSelectorExpr *SelExpr = cast<ObjCSelectorExpr>(ME->getArg(0));<br><br>This could fail if the user passes a SEL variable.<br><br></blockquote><br>Well spotted. I have added a helper method to extract the ObjCSelectorExpr in the case of a SEL variable, it is very ugly code though, is there an easier way to do this? see selectorForArgument().<br></blockquote><br>The way you've done it will break for re-assignments, so that won't work. I think the right thing to do is just ignore that case for now; in the long term, I think the correct solution is to model SEL regions in the same sort of way as we do string literals.<br><br></blockquote><br>OK, I removed the code and replaced it with a TODO for now.<br><br><blockquote type="cite"><br>I'm still concerned about the diagnostic text:<br><br>+  os << "Calling method introduced in ";<br>+  os << Introduced;<br>+  os << " (deployment target is ";<br>+  os << deploymentTarget(State);<br>+  os << ")";<br><br>At the very least we need to distinguish "method" and "function"; for bonus points, saying that the entire class or protocol was introduced in version X would be nice polish.<br><br>Jordan<br></blockquote><br>How about the attached patch? It prints the class or protocol version when the method has no specific introduced version.<br></blockquote><br></div><div>The logic all seems correct here, but I think we can still do better on the message. The class and protocol cases seem a little underinformative to me, especially since the analyzer doesn't have a note where the availability shows up. So instead of a version kind, how about just passing the decl that has the availability attribute? That way we can say "method", "function", "class 'Foo'", or "protocol 'Foo'".</div><div><br></div><div>Also, it would be nice to include the platform name with the version. This code is stolen from DeclBase.cpp, but I don't have a better place for it right now.</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">  <span style="color: #4f8187">StringRef</span> TargetPlatform = Context.<span style="color: #31595d">getTargetInfo</span>().<span style="color: #31595d">getPlatformName</span>();</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">  <span style="color: #4f8187">StringRef</span> PrettyPlatformName</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">    = <span style="color: #4f8187">AvailabilityAttr</span>::<span style="color: #31595d">getPrettyPlatformName</span>(TargetPlatform);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">  <span style="color: #bb2ca2">if</span> (PrettyPlatformName.<span style="color: #31595d">empty</span>())</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">    PrettyPlatformName = TargetPlatform;</div><div><br></div><div>"Calling method introduced in OS X 10.9 (deployment target is 10.8)"</div><div><br></div><div>But other than this polish this is looking very good. Have you tried running it on existing projects?</div><div>Jordan</div></div><br></body></html>