clang/test/Analysis/Checkers/WebKit/unretained-local-vars-weak-arc.mm
raw| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UnretainedLocalVarsChecker -fobjc-runtime-has-weak -fobjc-weak -fobjc-arc -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | #include "objc-mock-types.h" |
| 5 | |
| 6 | NSString *provideStr(); |
| 7 | SomeObj *provideSomeObj(); |
| 8 | |
| 9 | int foo() { |
| 10 | __weak NSString *weakStr = provideStr(); |
| 11 | __weak SomeObj *weakObj = provideSomeObj(); |
| 12 | return [weakStr length] + [weakObj value]; |
| 13 | } |