diff options
| author | Steven Wu <stevenwu@apple.com> | 2016-03-10 02:02:48 +0000 |
|---|---|---|
| committer | Steven Wu <stevenwu@apple.com> | 2016-03-10 02:02:48 +0000 |
| commit | 92910f69a06e299beafb537ca08bc63e75a38612 (patch) | |
| tree | efec00fb23fa0cb706f34db8bb4cd446de8ad42e /clang/test/SemaObjC/warn-loop-analysis.m | |
| parent | 09b4a8daa354382c294e736fc9db018621376728 (diff) | |
| download | bcm5719-llvm-92910f69a06e299beafb537ca08bc63e75a38612.tar.gz bcm5719-llvm-92910f69a06e299beafb537ca08bc63e75a38612.zip | |
Fix false positives for for-loop-analysis warning
Summary:
For PseudoObjectExpr, the DeclMatcher need to search only all the semantics
but also need to search pass OpaqueValueExpr for all potential uses for the
Decl.
Reviewers: thakis, rtrieu, rjmccall, doug.gregor
Subscribers: xazax.hun, rjmccall, doug.gregor, cfe-commits
Differential Revision: http://reviews.llvm.org/D17627
llvm-svn: 263087
Diffstat (limited to 'clang/test/SemaObjC/warn-loop-analysis.m')
| -rw-r--r-- | clang/test/SemaObjC/warn-loop-analysis.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/warn-loop-analysis.m b/clang/test/SemaObjC/warn-loop-analysis.m new file mode 100644 index 00000000000..8ae7375f7f2 --- /dev/null +++ b/clang/test/SemaObjC/warn-loop-analysis.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s +// expected-no-diagnostics + +@interface MyArray +- (id)objectAtIndexedSubscript:(unsigned int)idx; +@end + +// Do not warn on objc classes has objectAtIndexedSubscript method. +MyArray *test; +void foo() +{ + unsigned int i; + for (i = 42; i > 0;) // No warnings here + (void)test[--i]; +} |

