r217704 - Allow protocols to be just declared.
Jordan Rose
jordan_rose at apple.com
Fri Sep 12 17:48:03 PDT 2014
I'm pretty sure we were interested in banning this feature (in fact, I thought the feature had already been banned) because it's not compatible with __attribute__((objc_runtime_name)). Why are you interested in it?
Jordan
> On Sep 12, 2014, at 13:14, Rafael Espindola <rafael.espindola at gmail.com> wrote:
>
> Author: rafael
> Date: Fri Sep 12 15:14:20 2014
> New Revision: 217704
>
> URL: http://llvm.org/viewvc/llvm-project?rev=217704&view=rev
> Log:
> Allow protocols to be just declared.
>
> Added:
> cfe/trunk/test/CodeGenObjC/undefined-protocol2.m
> Modified:
> cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=217704&r1=217703&r2=217704&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Sep 12 15:14:20 2014
> @@ -6236,7 +6236,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
> // contents for protocols which were referenced but never defined.
> Entry =
> new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy,
> - false, llvm::GlobalValue::WeakAnyLinkage,
> + false, llvm::GlobalValue::ExternalLinkage,
> nullptr,
> "\01l_OBJC_PROTOCOL_$_" + PD->getObjCRuntimeNameAsString());
> Entry->setSection("__DATA,__datacoal_nt,coalesced");
> @@ -6347,8 +6347,8 @@ llvm::Constant *CGObjCNonFragileABIMac::
> Values);
>
> if (Entry) {
> - // Already created, update the initializer.
> - assert(Entry->hasWeakAnyLinkage());
> + // Already created, fix the linkage and update the initializer.
> + Entry->setLinkage(llvm::GlobalValue::WeakAnyLinkage);
> Entry->setInitializer(Init);
> } else {
> Entry =
>
> Added: cfe/trunk/test/CodeGenObjC/undefined-protocol2.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/undefined-protocol2.m?rev=217704&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/undefined-protocol2.m (added)
> +++ cfe/trunk/test/CodeGenObjC/undefined-protocol2.m Fri Sep 12 15:14:20 2014
> @@ -0,0 +1,17 @@
> +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s
> +
> +// Test that we produce a declaration for the protocol. It must be matched
> +// by a definition in another TU, so external is the correct linkage
> +// (not extern_weak).
> +// CHECK: @"\01l_OBJC_PROTOCOL_$_p1" = external global
> +
> + at interface NSObject
> + at end
> +
> + at protocol p1;
> +
> + at interface I1 : NSObject <p1>
> + at end
> +
> + at implementation I1
> + at end
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list