forked from OSchip/llvm-project
				
			- Generate error for protocol qualifiers on 'Class'.
- Generate error for protocol qualifiers on non-ObjC types. llvm-svn: 65333
This commit is contained in:
		
							parent
							
								
									91362dd011
								
							
						
					
					
						commit
						a94e52c687
					
				| 
						 | 
					@ -1400,6 +1400,8 @@ DIAG(warn_objc_array_of_interfaces, WARNING,
 | 
				
			||||||
     "array of interface %0 should probably be an array of pointers")
 | 
					     "array of interface %0 should probably be an array of pointers")
 | 
				
			||||||
DIAG(ext_c99_array_usage, EXTENSION,
 | 
					DIAG(ext_c99_array_usage, EXTENSION,
 | 
				
			||||||
     "use of C99-specific array features, accepted as an extension")
 | 
					     "use of C99-specific array features, accepted as an extension")
 | 
				
			||||||
DIAG(warn_ignoring_objc_qualifiers, WARNING,
 | 
					DIAG(err_invalid_protocol_qualifiers, ERROR,
 | 
				
			||||||
     "ignoring protocol qualifiers on non-ObjC type")
 | 
					     "invalid protocol qualifiers on non-ObjC type")
 | 
				
			||||||
 | 
					DIAG(err_qualified_class_unsupported, ERROR,
 | 
				
			||||||
 | 
					     "protocol qualified 'Class' is unsupported")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,9 +151,13 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
 | 
				
			||||||
        // id<protocol-list>
 | 
					        // id<protocol-list>
 | 
				
			||||||
        Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ,
 | 
					        Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ,
 | 
				
			||||||
                                                DS.getNumProtocolQualifiers());
 | 
					                                                DS.getNumProtocolQualifiers());
 | 
				
			||||||
      else
 | 
					      else if (Result == Context.getObjCClassType())
 | 
				
			||||||
 | 
					        // Class<protocol-list>
 | 
				
			||||||
        Diag(DS.getSourceRange().getBegin(), 
 | 
					        Diag(DS.getSourceRange().getBegin(), 
 | 
				
			||||||
             diag::warn_ignoring_objc_qualifiers) << DS.getSourceRange();
 | 
					             diag::err_qualified_class_unsupported) << DS.getSourceRange();
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        Diag(DS.getSourceRange().getBegin(),
 | 
				
			||||||
 | 
					             diag::err_invalid_protocol_qualifiers) << DS.getSourceRange();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // TypeQuals handled by caller.
 | 
					    // TypeQuals handled by caller.
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,4 +26,10 @@ void foo(id x) {
 | 
				
			||||||
typedef int NotAnObjCObjectType;
 | 
					typedef int NotAnObjCObjectType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GCC doesn't diagnose this.
 | 
					// GCC doesn't diagnose this.
 | 
				
			||||||
NotAnObjCObjectType <SomeProtocol> *obj; // expected-warning {{ignoring protocol qualifiers on non-ObjC type}}
 | 
					NotAnObjCObjectType <SomeProtocol> *obj; // expected-error {{invalid protocol qualifiers on non-ObjC type}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Decided not to support the following GCC extension. Found while researching rdar://6497631
 | 
				
			||||||
 | 
					typedef struct objc_class *Class;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Class <SomeProtocol> UnfortunateGCCExtension; // expected-error {{protocol qualified 'Class' is unsupported}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
__attribute ((unavailable))
 | 
					__attribute ((unavailable))
 | 
				
			||||||
@protocol FwProto; // expected-note{{marked unavailable}}
 | 
					@protocol FwProto; // expected-note{{marked unavailable}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Class <FwProto> cFw = 0;  // expected-warning {{'FwProto' is unavailable}} expected-warning{{ignoring protocol qualifiers on non-ObjC type}}
 | 
					Class <FwProto> cFw = 0;  // expected-warning {{'FwProto' is unavailable}} expected-error{{protocol qualified 'Class' is unsupported}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__attribute ((deprecated)) @protocol MyProto1
 | 
					__attribute ((deprecated)) @protocol MyProto1
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ __attribute ((deprecated)) @protocol MyProto1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Class <MyProto1> clsP1 = 0;  // expected-warning {{'MyProto1' is deprecated}} expected-warning{{ignoring protocol qualifiers on non-ObjC type}}
 | 
					Class <MyProto1> clsP1 = 0;  // expected-warning {{'MyProto1' is deprecated}} expected-error{{protocol qualified 'Class' is unsupported}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@protocol FwProto @end // expected-note{{marked unavailable}}
 | 
					@protocol FwProto @end // expected-note{{marked unavailable}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue