for metadata symbols for forward referenced protocols which
are never defined. // rdar://
16203115
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202761
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Entry) {
// Already created, fix the linkage and update the initializer.
+ Entry->setLinkage(llvm::GlobalValue::PrivateLinkage);
Entry->setInitializer(Init);
} else {
Entry =
if (Entry) {
// Already created, fix the linkage and update the initializer.
- assert(Entry->getLinkage() == llvm::GlobalValue::WeakAnyLinkage);
+ Entry->setLinkage(llvm::GlobalValue::WeakAnyLinkage);
Entry->setInitializer(Init);
} else {
Entry =
--- /dev/null
+// RUN: %clang_cc1 -emit-llvm -x objective-c %s -o - | FileCheck %s
+// rdar://16203115
+
+@interface NSObject @end
+
+@protocol P0;
+
+@interface A : NSObject <P0>
++(Class) getClass;
+@end
+
+@implementation A
++(Class) getClass { return self; }
+@end
+
+int main() {
+ Protocol *P0 = @protocol(P0);
+ return 0;
+}
+
+// CHECK: @"\01l_OBJC_PROTOCOL_$_P0" = weak hidden global
+// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = private global
+// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P0" = weak hidden global
+// CHECK: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global