
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
20 lines
518 B
Plaintext
20 lines
518 B
Plaintext
// RUN: %clang_cc1 -std=gnu++17 -verify %s
|
|
|
|
// expected-no-diagnostics
|
|
|
|
typedef const struct __CFString * CFStringRef;
|
|
|
|
extern "C" {
|
|
typedef const struct __attribute__((objc_bridge(NSString))) __CFString * CFStringRef;
|
|
typedef struct __attribute__((objc_bridge_mutable(NSMutableString))) __CFString * CFMutableStringRef;
|
|
}
|
|
|
|
@interface NSString @end
|
|
@interface NSMutableString : NSString @end
|
|
|
|
void CFStringGetLength(CFStringRef theString);
|
|
|
|
int main() {
|
|
CFStringGetLength((__bridge CFStringRef)(NSString *)0);
|
|
}
|