From 0a525340ada570897ab34918c98de1cf94ad7770 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 14 Feb 2012 19:31:35 +0000 Subject: [PATCH] more objective-c translator for modern abi. metadata for protocol definitions used on class qualifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150498 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Rewrite/RewriteModernObjC.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp index 37a4a7cb21..d67483a494 100644 --- a/lib/Rewrite/RewriteModernObjC.cpp +++ b/lib/Rewrite/RewriteModernObjC.cpp @@ -5207,7 +5207,7 @@ void RewriteModernObjC::RewriteIvarOffsetComputation(ObjCIvarDecl *ivar, /// const uint8_t * const ivarLayout; /// const char *const name; /// const struct _method_list_t * const baseMethods; -/// const struct _objc_protocol_list *const baseProtocols; +/// const struct _protocol_list_t *const baseProtocols; /// const struct _ivar_list_t *const ivars; /// const uint8_t * const weakIvarLayout; /// const struct _prop_list_t * const properties; @@ -5823,6 +5823,24 @@ void RewriteModernObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, Write_method_list_t_initializer(*this, Context, Result, ClassMethods, "_OBJC_$_CLASS_METHODS_", IDecl->getNameAsString(), true); + + // Protocols referenced in class declaration? + // Protocol's super protocol list + std::vector RefedProtocols; + const ObjCList &Protocols = CDecl->getReferencedProtocols(); + for (ObjCList::iterator I = Protocols.begin(), + E = Protocols.end(); + I != E; ++I) { + RefedProtocols.push_back(*I); + // Must write out all protocol definitions in current qualifier list, + // and in their nested qualifiers before writing out current definition. + RewriteObjCProtocolMetaData(*I, Result); + } + + Write_protocol_list_initializer(Context, Result, + RefedProtocols, + "_OBJC_CLASS_PROTOCOLS_$_", + IDecl->getNameAsString()); } -- 2.40.0