
Objective-C type arguments can be provided in angle brackets following an Objective-C interface type. Syntactically, this is the same position as one would provide protocol qualifiers (e.g., id<NSCopying>), so parse both together and let Sema sort out the ambiguous cases. This applies both when parsing types and when parsing the superclass of an Objective-C class, which can now be a specialized type (e.g., NSMutableArray<T> inherits from NSArray<T>). Check Objective-C type arguments against the type parameters of the corresponding class. Verify the length of the type argument list and that each type argument satisfies the corresponding bound. Specializations of parameterized Objective-C classes are represented in the type system as distinct types. Both specialized types (e.g., NSArray<NSString *> *) and unspecialized types (NSArray *) are represented, separately. llvm-svn: 241542
27 lines
705 B
Plaintext
27 lines
705 B
Plaintext
// RUN: %clang_cc1 -std=c++11 %s -verify
|
|
|
|
// expected-no-diagnostics
|
|
@protocol NSObject
|
|
@end
|
|
|
|
@protocol NSCopying
|
|
@end
|
|
|
|
__attribute__((objc_root_class))
|
|
@interface NSObject <NSObject>
|
|
@end
|
|
|
|
@interface NSString : NSObject
|
|
@end
|
|
|
|
// --------------------------------------------------------------------------
|
|
// Parsing parameterized classes.
|
|
// --------------------------------------------------------------------------
|
|
@interface PC1<T, U, V> : NSObject
|
|
@end
|
|
|
|
// --------------------------------------------------------------------------
|
|
// Parsing type arguments.
|
|
// --------------------------------------------------------------------------
|
|
typedef PC1<::NSString *, NSString *, id<NSCopying>> typeArgs1;
|