ObjectiveC: fix a seg fault when deserialing redeclaration of ObjCMethodDecl.
authorManman Ren <manman.ren@gmail.com>
Mon, 3 Oct 2016 21:26:46 +0000 (21:26 +0000)
committerManman Ren <manman.ren@gmail.com>
Mon, 3 Oct 2016 21:26:46 +0000 (21:26 +0000)
commita0042c4922681d5a8c667b4607cb0b41478f5389
treea2f92fab12b5c6363c3a644f8bca86446d3c6de5
parent3a06701913c7b31c4d2608b7aa385c677677efb7
ObjectiveC: fix a seg fault when deserialing redeclaration of ObjCMethodDecl.

The deserialization of redeclartion can cause seg fault since getCanonicalDecl
of the redeclaration returns the lookup result on the ObjCContainerDecl,
which can be null if FindExternalVisibleDeclsByName is not done updating
the lookup results.

The fix is to return the redeclaration itself as the canonical decl. Note that
the handling for redeclaration of ObjCMethodDecl is not in line with other
redeclarables.

rdar://28488466

llvm-svn: 283145
clang/lib/AST/DeclObjC.cpp
clang/test/Modules/Inputs/objc-method-redecl.h [new file with mode: 0644]
clang/test/Modules/objc-method-redecl.m [new file with mode: 0644]