<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;">On Mar 29, 2013, at 2:54 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Test case?</div></div></blockquote><div><br></div><div>In r178378.</div><div><br></div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 29, 2013, at 14:51 , Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: akirtzidis<br>Date: Fri Mar 29 16:51:48 2013<br>New Revision: 178374<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=178374&view=rev">http://llvm.org/viewvc/llvm-project?rev=178374&view=rev</a><br>Log:<br>When looking for overridden ObjC methods, don't ignore 'hidden' ones.<br><br>When using modules we should not ignore overridden methods from<br>categories that are hidden because the module is not visible.<br>This will give more consistent results (when imports change) and it's more<br>correct since the methods are indeed overridden even if they are not "visible"<br>for lookup purposes.<br><br><a href="rdar://13350796">rdar://13350796</a><br><br>Modified:<br> cfe/trunk/include/clang/AST/DeclObjC.h<br> cfe/trunk/lib/AST/DeclObjC.cpp<br> cfe/trunk/lib/Sema/SemaDeclObjC.cpp<br><br>Modified: cfe/trunk/include/clang/AST/DeclObjC.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=178374&r1=178373&r2=178374&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=178374&r1=178373&r2=178374&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/AST/DeclObjC.h (original)<br>+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Mar 29 16:51:48 2013<br>@@ -537,12 +537,14 @@ public:<br> }<br><br> // Get the local instance/class method declared in this interface.<br>- ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const;<br>- ObjCMethodDecl *getInstanceMethod(Selector Sel) const {<br>- return getMethod(Sel, true/*isInstance*/);<br>+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance,<br>+ bool AllowHidden = false) const;<br>+ ObjCMethodDecl *getInstanceMethod(Selector Sel,<br>+ bool AllowHidden = false) const {<br>+ return getMethod(Sel, true/*isInstance*/, AllowHidden);<br> }<br>- ObjCMethodDecl *getClassMethod(Selector Sel) const {<br>- return getMethod(Sel, false/*isInstance*/);<br>+ ObjCMethodDecl *getClassMethod(Selector Sel, bool AllowHidden = false) const {<br>+ return getMethod(Sel, false/*isInstance*/, AllowHidden);<br> }<br> bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const;<br> ObjCIvarDecl *getIvarDecl(IdentifierInfo *Id) const;<br><br>Modified: cfe/trunk/lib/AST/DeclObjC.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=178374&r1=178373&r2=178374&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=178374&r1=178373&r2=178374&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/AST/DeclObjC.cpp (original)<br>+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Mar 29 16:51:48 2013<br>@@ -65,12 +65,13 @@ ObjCContainerDecl::getIvarDecl(Identifie<br><br>// Get the local instance/class method declared in this interface.<br>ObjCMethodDecl *<br>-ObjCContainerDecl::getMethod(Selector Sel, bool isInstance) const {<br>+ObjCContainerDecl::getMethod(Selector Sel, bool isInstance,<br>+ bool AllowHidden) const {<br> // If this context is a hidden protocol definition, don't find any<br> // methods there.<br> if (const ObjCProtocolDecl *Proto = dyn_cast<ObjCProtocolDecl>(this)) {<br> if (const ObjCProtocolDecl *Def = Proto->getDefinition())<br>- if (Def->isHidden())<br>+ if (Def->isHidden() && !AllowHidden)<br> return 0;<br> }<br><br>@@ -854,7 +855,8 @@ static void CollectOverriddenMethodsRecu<br> if (MovedToSuper)<br> if (ObjCMethodDecl *<br> Overridden = Container->getMethod(Method->getSelector(),<br>- Method->isInstanceMethod()))<br>+ Method->isInstanceMethod(),<br>+ /*AllowHidden=*/true))<br> if (Method != Overridden) {<br> // We found an override at this category; there is no need to look<br> // into its protocols.<br>@@ -872,7 +874,8 @@ static void CollectOverriddenMethodsRecu<br> // Check whether we have a matching method at this level.<br> if (const ObjCMethodDecl *<br> Overridden = Container->getMethod(Method->getSelector(),<br>- Method->isInstanceMethod()))<br>+ Method->isInstanceMethod(),<br>+ /*AllowHidden=*/true))<br> if (Method != Overridden) {<br> // We found an override at this level; there is no need to look<br> // into other protocols or categories.<br>@@ -894,9 +897,9 @@ static void CollectOverriddenMethodsRecu<br> P != PEnd; ++P)<br> CollectOverriddenMethodsRecurse(*P, Method, Methods, MovedToSuper);<br><br>- for (ObjCInterfaceDecl::visible_categories_iterator<br>- Cat = Interface->visible_categories_begin(),<br>- CatEnd = Interface->visible_categories_end();<br>+ for (ObjCInterfaceDecl::known_categories_iterator<br>+ Cat = Interface->known_categories_begin(),<br>+ CatEnd = Interface->known_categories_end();<br> Cat != CatEnd; ++Cat) {<br> CollectOverriddenMethodsRecurse(*Cat, Method, Methods,<br> MovedToSuper);<br>@@ -931,7 +934,8 @@ static void collectOverriddenMethodsSlow<br> // Start searching for overridden methods using the method from the<br> // interface as starting point.<br> if (const ObjCMethodDecl *IFaceMeth = ID->getMethod(Method->getSelector(),<br>- Method->isInstanceMethod()))<br>+ Method->isInstanceMethod(),<br>+ /*AllowHidden=*/true))<br> Method = IFaceMeth;<br> CollectOverriddenMethods(ID, Method, overridden);<br><br>@@ -943,7 +947,8 @@ static void collectOverriddenMethodsSlow<br> // Start searching for overridden methods using the method from the<br> // interface as starting point.<br> if (const ObjCMethodDecl *IFaceMeth = ID->getMethod(Method->getSelector(),<br>- Method->isInstanceMethod()))<br>+ Method->isInstanceMethod(),<br>+ /*AllowHidden=*/true))<br> Method = IFaceMeth;<br> CollectOverriddenMethods(ID, Method, overridden);<br><br>@@ -962,9 +967,9 @@ static void collectOnCategoriesAfterLoca<br> if (!Class)<br> return;<br><br>- for (ObjCInterfaceDecl::visible_categories_iterator<br>- Cat = Class->visible_categories_begin(),<br>- CatEnd = Class->visible_categories_end();<br>+ for (ObjCInterfaceDecl::known_categories_iterator<br>+ Cat = Class->known_categories_begin(),<br>+ CatEnd = Class->known_categories_end();<br> Cat != CatEnd; ++Cat) {<br> if (SM.isBeforeInTranslationUnit(Loc, Cat->getLocation()))<br> CollectOverriddenMethodsRecurse(*Cat, Method, Methods, true);<br><br>Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=178374&r1=178373&r2=178374&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=178374&r1=178373&r2=178374&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)<br>+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Mar 29 16:51:48 2013<br>@@ -2727,9 +2727,9 @@ private:<br> return;<br><br> // - categories,<br>- for (ObjCInterfaceDecl::visible_categories_iterator<br>- cat = iface->visible_categories_begin(),<br>- catEnd = iface->visible_categories_end();<br>+ for (ObjCInterfaceDecl::known_categories_iterator<br>+ cat = iface->known_categories_begin(),<br>+ catEnd = iface->known_categories_end();<br> cat != catEnd; ++cat) {<br> search(*cat);<br> }<br>@@ -2759,7 +2759,8 @@ private:<br> void search(ObjCContainerDecl *container) {<br> // Check for a method in this container which matches this selector.<br> ObjCMethodDecl *meth = container->getMethod(Method->getSelector(),<br>- Method->isInstanceMethod());<br>+ Method->isInstanceMethod(),<br>+ /*AllowHidden=*/true);<br><br> // If we find one, record it and bail out.<br> if (meth) {<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></div></div></blockquote></div><br></body></html>