[cfe-commits] r68806 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/protocol-definition-hidden-visibility.m

Fariborz Jahanian fjahanian at apple.com
Fri Apr 10 11:47:35 PDT 2009


Author: fjahanian
Date: Fri Apr 10 13:47:34 2009
New Revision: 68806

URL: http://llvm.org/viewvc/llvm-project?rev=68806&view=rev
Log:
Patch to generate meta-data for prtocol used
in @protocol expression.


Added:
    cfe/trunk/test/CodeGenObjC/protocol-definition-hidden-visibility.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=68806&r1=68805&r2=68806&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Apr 10 13:47:34 2009
@@ -4327,7 +4327,10 @@
 llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CGBuilderTy &Builder,
                                             const ObjCProtocolDecl *PD) {
   
-  llvm::Constant *Init =  llvm::ConstantExpr::getBitCast(GetProtocolRef(PD),
+  // This routine is called for @protocol only. So, we must build definition
+  // of protocol's meta-data (not a reference to it!)
+  //
+  llvm::Constant *Init =  llvm::ConstantExpr::getBitCast(GetOrEmitProtocol(PD),
                                         ObjCTypes.ExternalProtocolPtrTy);
   
   std::string ProtocolName("\01l_OBJC_PROTOCOL_REFERENCE_$_");

Added: cfe/trunk/test/CodeGenObjC/protocol-definition-hidden-visibility.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/protocol-definition-hidden-visibility.m?rev=68806&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/protocol-definition-hidden-visibility.m (added)
+++ cfe/trunk/test/CodeGenObjC/protocol-definition-hidden-visibility.m Fri Apr 10 13:47:34 2009
@@ -0,0 +1,19 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10  -S -o - %s | grep -e "private_extern l_OBJC_PROTOCOL_" | count 2
+
+ at interface FOO @end
+
+ at interface NSObject @end
+
+ at protocol SSHIPCProtocolHandler_BDC;
+
+typedef NSObject<SSHIPCProtocolHandler_BDC> _SSHIPCProtocolHandler_BDC;
+
+ at interface SSHIPC_v2_RPFSProxy
+ at property(nonatomic,readonly,retain) _SSHIPCProtocolHandler_BDC* protocolHandler_BDC;
+ at end
+
+ at implementation FOO
+- (_SSHIPCProtocolHandler_BDC*) protocolHandler_BDC {@protocol(SSHIPCProtocolHandler_BDC); }
+ at end
+
+





More information about the cfe-commits mailing list