Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions clang/lib/AST/DeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,8 @@ ObjCMethodDecl *ObjCMethodDecl::getNextRedeclarationImpl() {
if (!Redecl && isRedeclaration()) {
// This is the last redeclaration, go back to the first method.
return cast<ObjCContainerDecl>(CtxD)->getMethod(getSelector(),
isInstanceMethod());
isInstanceMethod(),
/*AllowHidden=*/true);
}

return Redecl ? Redecl : this;
Expand Down Expand Up @@ -982,7 +983,8 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
if (isRedeclaration()) {
// It is possible that we have not done deserializing the ObjCMethod yet.
ObjCMethodDecl *MD =
cast<ObjCContainerDecl>(CtxD)->getMethod(Sel, isInstanceMethod());
cast<ObjCContainerDecl>(CtxD)->getMethod(Sel, isInstanceMethod(),
/*AllowHidden=*/true);
return MD ? MD : this;
}

Expand Down Expand Up @@ -1299,8 +1301,9 @@ void ObjCMethodDecl::getOverriddenMethods(
const ObjCMethodDecl *Method = this;

if (Method->isRedeclaration()) {
Method = cast<ObjCContainerDecl>(Method->getDeclContext())->
getMethod(Method->getSelector(), Method->isInstanceMethod());
Method = cast<ObjCContainerDecl>(Method->getDeclContext())
->getMethod(Method->getSelector(), Method->isInstanceMethod(),
/*AllowHidden=*/true);
}

if (Method->isOverriding()) {
Expand Down
7 changes: 7 additions & 0 deletions clang/test/Index/Inputs/hidden-redecls-sub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@protocol P1
- (void)p1_method;
- (void)p1_method;
@end

@interface Foo (SubP1) <P1>
@end
3 changes: 3 additions & 0 deletions clang/test/Index/Inputs/hidden-redecls.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@interface Foo
- (void)parent_method;
@end
8 changes: 8 additions & 0 deletions clang/test/Index/Inputs/module.map
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ module PreambleWithImplicitImport {
export *
}
}

module hidden_redecls {
header "hidden-redecls.h"

explicit module sub {
header "hidden-redecls-sub.h"
}
}
12 changes: 12 additions & 0 deletions clang/test/Index/hidden-redecls.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@import hidden_redecls;

@interface Foo (Top)
- (void)top_method;
@end

// p1_method in protocol P1 is hidden since module_redecls.sub hasn't been
// imported yet. Check it is still indexed.

// RUN: c-index-test -index-file-full %s -isystem %S/Inputs -fmodules -target x86_64-apple-macosx10.7 | FileCheck %s
// CHECK: [indexDeclaration]: kind: objc-instance-method | name: p1_method | {{.*}} | loc: {{.*}}hidden-redecls-sub.h:2:9 | {{.*}} | isRedecl: 0
// CHECK: [indexDeclaration]: kind: objc-instance-method | name: p1_method | {{.*}} | loc: {{.*}}hidden-redecls-sub.h:3:9 | {{.*}} | isRedecl: 1