зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
cce70c7c5f
Коммит
6f2a9fa0f7
|
@ -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'}}
|
||||
}
|
Загрузка…
Ссылка в новой задаче