Improve on diagnostics when an objc class is used as

a stand-alone type declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2010-04-07 00:22:00 +00:00
Родитель e8f5a1710a
Коммит e9f5581ad4
5 изменённых файлов: 15 добавлений и 14 удалений

Просмотреть файл

@ -215,7 +215,8 @@ def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">;
def err_statically_allocated_object : Error<
"interface type cannot be statically allocated">;
def err_object_cannot_be_passed_returned_by_value : Error<
"interface type %1 cannot be %select{returned|passed}0 by value">;
"interface type %1 cannot be %select{returned|passed}0 by value"
"; did you forget * in %1">;
def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
def warn_pragma_pack_invalid_alignment : Warning<
"expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">;

Просмотреть файл

@ -14,7 +14,7 @@ void test1() {
id objects[] = {[NSNumber METH]};
}
void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value}}
void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
id objects[] = {[x METH]};
}

Просмотреть файл

@ -39,10 +39,10 @@ void foo7(id (^x)(int)) {
@end
void foo8() {
void *P = ^(itf x) {}; // expected-error {{Objective-C interface type 'itf' cannot be passed by value}}
P = ^itf(int x) {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}}
P = ^itf() {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}}
P = ^itf{}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}}
void *P = ^(itf x) {}; // expected-error {{Objective-C interface type 'itf' cannot be passed by value; did you forget * in 'itf'}}
P = ^itf(int x) {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value; did you forget * in 'itf'}}
P = ^itf() {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value; did you forget * in 'itf'}}
P = ^itf{}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value; did you forget * in 'itf'}}
}

Просмотреть файл

@ -27,8 +27,8 @@ struct whatever {
}
@end
Super foo( // expected-error{{interface interface type 'Super' cannot be returned by value}}
Super parm1) { // expected-error{{interface interface type 'Super' cannot be passed by value}}
Super foo( // expected-error{{interface interface type 'Super' cannot be returned by value; did you forget * in 'Super'}}
Super parm1) { // expected-error{{interface interface type 'Super' cannot be passed by value; did you forget * in 'Super'}}
Super p1; // expected-error{{interface type cannot be statically allocated}}
return p1;
}

Просмотреть файл

@ -7,21 +7,21 @@
@end
@interface bar
-(void) my_method:(foo) my_param; // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
- (foo)cccccc:(long)ddddd; // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
-(void) my_method:(foo) my_param; // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
- (foo)cccccc:(long)ddddd; // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
@end
@implementation bar
-(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
-(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
{
}
- (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
- (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
{
}
@end
void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
// rdar://6780761
void f0(foo *a0) {