diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-04-08 18:51:08 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-04-08 18:51:08 +0000 |
| commit | 5451c60f5a0d663ada3f4e75564a5c5eec50cfd9 (patch) | |
| tree | e07748e09ed69c93419c58e330bd12a512043081 /clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m | |
| parent | d43aaad1b1347ce7fdc2b728f735fb482bd50bdf (diff) | |
| download | bcm5719-llvm-5451c60f5a0d663ada3f4e75564a5c5eec50cfd9.tar.gz bcm5719-llvm-5451c60f5a0d663ada3f4e75564a5c5eec50cfd9.zip | |
Enhance analyzer reasoning about sending messages to nil. A nil receiver returns 0 for scalars of size <= sizeof(void*).
llvm-svn: 68629
Diffstat (limited to 'clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m')
| -rw-r--r-- | clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m index a5e9c061bba..7d90f3a753a 100644 --- a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m +++ b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m @@ -46,3 +46,14 @@ void createFoo5() { double d = [obj doubleM]; // no-warning } +void handleNilPruneLoop(MyClass *obj) { + if (!!obj) + return; + + // Test if [obj intM] evaluates to 0, thus pruning the entire loop. + for (int i = 0; i < [obj intM]; i++) { + long long j = [obj longlongM]; // no-warning + } + + long long j = [obj longlongM]; // expected-warning{{The receiver in the message expression is 'nil' and results in the returned value}} +} |

