Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -34,6 +34,7 @@ #include "clang/Basic/Builtins.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/Capacity.h" @@ -6275,6 +6276,18 @@ (FD || EncodingProperty || EncodeClassNames)) { S += '"'; S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString(); + ArrayRef TypeArgs = OPT->getTypeArgs(); + if (!TypeArgs.empty()) { + S += '<'; + for (const auto &I : llvm::enumerate(TypeArgs)) { + if (I.Index) + S += ','; + getObjCEncodingForTypeImpl(I.Value, S, ExpandPointedToStructures, + ExpandStructures, nullptr, false, + EncodingProperty); + } + S += '>'; + } for (const auto *I : OPT->quals()) { S += '<'; S += I->getObjCRuntimeNameAsString(); Index: test/CodeGenObjC/objc2-property-encode.m =================================================================== --- test/CodeGenObjC/objc2-property-encode.m +++ test/CodeGenObjC/objc2-property-encode.m @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "T@\\\\22NSString\\\\22" %t +// RUN: FileCheck %s -input-file=%t @interface NSString @end typedef NSString StoreVersionID ; @@ -11,3 +12,30 @@ @implementation Parent @dynamic foo; @end + +// rdar://22496485 +@interface TypeParameters<__covariant ObjectType> + +@end + +@interface TypeParameters2<__covariant A, __covariant B> + +@end + +@protocol MyProtocol; +@class MyClass; + +@interface Bar + +@property(copy) TypeParameters *p1; + +@property(copy) TypeParameters2 *p2; + +@end + +@implementation Bar + +@end + +// CHECK: @OBJC_PROP_NAME_ATTR_{{.*}} = {{.*}} c"T@\22TypeParameters<@\22MyClass\22>\22,C,V_p1\00" +// CHECK: @OBJC_PROP_NAME_ATTR_{{.*}} = {{.*}} c"T@\22TypeParameters2<@\22MyClass\22,@\22MyClass\22>\22,C,V_p2\00"