brintos

brintos / llvm-project-archived public Read only

0
0
Text · 754 B · 0d345e8 Raw
24 lines · plain
1// RUN: %clang_analyze_cc1 -analyzer-checker=core -fobjc-arc -verify %s2// expected-no-diagnostics3@interface NSObject4@end5@interface NSString : NSObject6- (id)lastPathComponent;7@end8int getBool(void);9int *getPtr(void);10int foo(void) {11  int r = 0;12  NSString *filename = @"filename";13  for (int x = 0; x< 10; x++) {14    int *p = getPtr();15    // Liveness info is not computed correctly due to the following expression.16    // This happens due to CFG being special cased for short circuit operators.17    // Note, due to ObjC method call, the outermost logical operator is wrapped in ExprWithCleanups.18    // PR1815919    if ((p != 0) && (getBool()) && ([filename lastPathComponent]) && (getBool())) {20      r = *p; // no-warning21    }22  }23  return r;24}