Objective-C: patch to issue the conversion

warning when property-dot syntax is used
with -Wsign-conversion. // rdar://13855394


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181914 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2013-05-15 19:03:04 +00:00
Родитель cce70c7c5f
Коммит 6f2a9fa0f7
2 изменённых файлов: 28 добавлений и 1 удалений

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

@ -5133,7 +5133,13 @@ void AnalyzeImplicitConversions(Sema &S, Expr *OrigE, SourceLocation CC) {
CheckImplicitConversion(S, E, T, CC);
// Now continue drilling into this expression.
if (PseudoObjectExpr * POE = dyn_cast<PseudoObjectExpr>(E)) {
Expr *Result = POE->getResultExpr();
if (const OpaqueValueExpr *OVE = dyn_cast_or_null<OpaqueValueExpr>(Result))
return AnalyzeImplicitConversions(S, OVE->getSourceExpr(), CC);
}
// Skip past explicit casts.
if (isa<ExplicitCastExpr>(E)) {
E = cast<ExplicitCastExpr>(E)->getSubExpr()->IgnoreParenImpCasts();

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

@ -0,0 +1,21 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion %s
// rdar://13855394
@interface NSObject
- new;
@end
@interface X : NSObject
@property unsigned int uint;
@end
@implementation X
@synthesize uint;
@end
void foo() {
X *x = [X new];
signed int sint = -1;
[x setUint:sint]; // expected-warning {{implicit conversion changes signedness: 'int' to 'unsigned int'}}
x.uint = sint; // expected-warning {{implicit conversion changes signedness: 'int' to 'unsigned int'}}
}