xref: /aosp_15_r20/external/clang/test/SemaObjC/warn-loop-analysis.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -Wloop-analysis -verify %s
2*67e74705SXin Li// expected-no-diagnostics
3*67e74705SXin Li
4*67e74705SXin Li@interface MyArray
5*67e74705SXin Li- (id)objectAtIndexedSubscript:(unsigned int)idx;
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Li// Do not warn on objc classes has objectAtIndexedSubscript method.
9*67e74705SXin LiMyArray *test;
10*67e74705SXin Livoid foo()
11*67e74705SXin Li{
12*67e74705SXin Li  unsigned int i;
13*67e74705SXin Li  for (i = 42; i > 0;) // No warnings here
14*67e74705SXin Li    (void)test[--i];
15*67e74705SXin Li}
16