}
}
+/// \brief Move the given method to the back of the global list of methods.
+static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) {
+ // Find the entry for this selector in the method pool.
+ Sema::GlobalMethodPool::iterator Known
+ = S.MethodPool.find(Method->getSelector());
+ if (Known == S.MethodPool.end())
+ return;
+
+ // Retrieve the appropriate method list.
+ ObjCMethodList &Start = Method->isInstanceMethod()? Known->second.first
+ : Known->second.second;
+ bool Found = false;
+ for (ObjCMethodList *List = &Start; List; List = List->Next) {
+ if (!Found) {
+ if (List->Method == Method) {
+ Found = true;
+ } else {
+ // Keep searching.
+ continue;
+ }
+ }
+
+ if (List->Next)
+ List->Method = List->Next->Method;
+ else
+ List->Method = Method;
+ }
+}
+
void ASTReader::makeNamesVisible(const HiddenNames &Names) {
for (unsigned I = 0, N = Names.size(); I != N; ++I) {
switch (Names[I].getKind()) {
- case HiddenName::Declaration:
- Names[I].getDecl()->Hidden = false;
+ case HiddenName::Declaration: {
+ Decl *D = Names[I].getDecl();
+ bool wasHidden = D->Hidden;
+ D->Hidden = false;
+
+ if (wasHidden && SemaObj) {
+ if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(D)) {
+ moveMethodToBackOfGlobalList(*SemaObj, Method);
+ }
+ }
break;
-
+ }
case HiddenName::MacroVisibility: {
std::pair<IdentifierInfo *, MacroInfo *> Macro = Names[I].getMacro();
Macro.second->setHidden(!Macro.second->isPublic());
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify
-@import MethodPoolA;
-
-
-// in other file: // expected-note{{using}}
-
+@import MethodPoolA;
+@interface D
+- (void)method5:(D*)obj;
+@end
-// in other file: expected-note{{also found}}
+// in other file: // expected-note@7{{using}}
+// in other file: expected-note@12{{also found}}
void testMethod1(id object) {
[object method1];
[object method4]; // expected-warning{{instance method '-method4' not found (return type defaults to 'id')}}
}
+void testMethod5(id object, D* d) {
+ [object method5:d];
+}
+
@import MethodPoolB;
void testMethod1Again(id object) {
void testMethod4Again(id object) {
[object method4];
}
+
+void testMethod5Again(id object, D* d) {
+ [object method5:d];
+}