[SemaObjC] Fix a -Wbridge-cast false-positive
authorErik Pilkington <erik.pilkington@gmail.com>
Mon, 5 Apr 2021 13:05:56 +0000 (09:05 -0400)
committerErik Pilkington <erik.pilkington@gmail.com>
Mon, 5 Apr 2021 15:41:40 +0000 (11:41 -0400)
commit803b79221edfc2517e6bfc373e5f55609565b0e4
treeba37c968af350e428536d68a5ac6529ad16ce4cf
parent660c4e57b4a7ac71f9595f31bfdec114369f4ca0
[SemaObjC] Fix a -Wbridge-cast false-positive

Clang used to emit a bad -Wbridge-cast diagnostic on the cast in the attached
test. This was because, after 09abecef7, struct __CFString was not added to
lookup, so the objc_bridge attribute wasn't getting duplicated onto the most
recent declaration, causing us to fail to find it in getObjCBridgeAttr. This
patch fixes this by instead walking through the redeclarations to find an
appropriate bridge attribute. rdar://72823399

Differential revision: https://reviews.llvm.org/D99661
clang/lib/Sema/SemaExprObjC.cpp
clang/test/SemaObjCXX/bridge-cast-redecl.mm [new file with mode: 0644]