[AST] Fix crashes caused by redeclarations in hidden prototypes
authorBen Barham <ben_barham@apple.com>
Fri, 9 Oct 2020 02:48:33 +0000 (19:48 -0700)
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>
Fri, 9 Oct 2020 02:48:36 +0000 (19:48 -0700)
commitfbb499ef255b77c5a3300543de88956b13e706b7
tree564df43794f1ad13f5deab570e49d5c2f39343dc
parent8a5858c8fd50e6f5767a21854951c3ccba17e8c4
[AST] Fix crashes caused by redeclarations in hidden prototypes

ObjCContainerDecl.getMethod returns a nullptr by default when the
container is a hidden prototype. Callsites where the method is being
looked up on the redeclaration's own container should skip this check
since they (rightly) expect a valid method to be found.

Resolves rdar://69444243

Reviewed By: akyrtzi

Differential Revision: https://reviews.llvm.org/D89024
clang/lib/AST/DeclObjC.cpp
clang/test/Index/Inputs/hidden-redecls-sub.h [new file with mode: 0644]
clang/test/Index/Inputs/hidden-redecls.h [new file with mode: 0644]
clang/test/Index/Inputs/module.map
clang/test/Index/hidden-redecls.m [new file with mode: 0644]