blob: f2cd5aefffec34a3e36d433d8bf20d265f9d58bb [file] [log] [blame]
Devin Coughlin1d405832015-11-15 17:48:22 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wno-objc-root-class -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config inline-lambdas=true -verify %s
2
3int clang_analyzer_eval(int);
4
5@interface Super
6- (void)superMethod;
7@end
8
9@interface Sub : Super {
10 int _ivar1;
11 int _ivar2;
12}
13@end
14
15
16@implementation Sub
17- (void)callMethodOnSuperInCXXLambda; {
18 // Explicit capture.
19 [self]() {
20 [super superMethod];
21 }();
22
23 // Implicit capture.
24 [=]() {
25 [super superMethod];
26 }();
27}
28
29- (void)swapIvars {
30 int tmp = _ivar1;
31 _ivar1 = _ivar2;
32 _ivar2 = tmp;
33}
34
35- (void)callMethodOnSelfInCXXLambda; {
36 _ivar1 = 7;
37 _ivar2 = 8;
38 [self]() {
39 [self swapIvars];
40 }();
41
42 clang_analyzer_eval(_ivar1 == 8); // expected-warning{{TRUE}}
43 clang_analyzer_eval(_ivar2 == 7); // expected-warning{{TRUE}}
44}
45
46@end