diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2018-03-27 21:29:05 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2018-03-27 21:29:05 +0000 |
commit | ca7902f7d2d7b11c247421b6029e73bdda1b85d7 (patch) | |
tree | 7d897d65f33577a281129a658cff8305d18ac2e1 /clang/test/SemaObjC/integer-overflow.m | |
parent | 7cb26ad2ef0714b010269d92eb5570f6a1b619df (diff) | |
download | bcm5719-llvm-ca7902f7d2d7b11c247421b6029e73bdda1b85d7.tar.gz bcm5719-llvm-ca7902f7d2d7b11c247421b6029e73bdda1b85d7.zip |
[Sema] Emit -Winteger-overflow for arguments in function calls, ObjC messages.
rdar://problem/35539384
Reviewers: ahatanak, nicholas, rsmith, jkorous-apple
Reviewed By: jkorous-apple
Subscribers: cfe-commits, jkorous-apple
Differential Revision: https://reviews.llvm.org/D42938
llvm-svn: 328671
Diffstat (limited to 'clang/test/SemaObjC/integer-overflow.m')
-rw-r--r-- | clang/test/SemaObjC/integer-overflow.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/integer-overflow.m b/clang/test/SemaObjC/integer-overflow.m new file mode 100644 index 00000000000..6d82e2951c1 --- /dev/null +++ b/clang/test/SemaObjC/integer-overflow.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -Wno-objc-root-class -fsyntax-only -verify %s + +@interface Foo +@end + +@implementation Foo +- (int)add:(int)a with:(int)b { + return a + b; +} + +- (void)testIntegerOverflows { +// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}} + (void)[self add:0 with:4608 * 1024 * 1024]; + +// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}} + (void)[self add:0 with:[self add:4608 * 1024 * 1024 with:0]]; +} +@end |