File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -163,10 +163,11 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
163
163
if (OCE->getOperator () == OO_Star && OCE->getNumArgs () == 1 )
164
164
E = OCE->getArg (0 );
165
165
}
166
- auto *ME = dyn_cast<MemberExpr>(E);
167
- if (!ME)
168
- return false ;
169
- auto *D = ME->getMemberDecl ();
166
+ const ValueDecl *D = nullptr ;
167
+ if (auto *ME = dyn_cast<MemberExpr>(E))
168
+ D = ME->getMemberDecl ();
169
+ else if (auto *IVR = dyn_cast<ObjCIvarRefExpr>(E))
170
+ D = IVR->getDecl ();
170
171
if (!D)
171
172
return false ;
172
173
auto T = D->getType ();
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2
- // expected-no-diagnostics
3
2
4
3
#import " mock-types.h"
5
4
#import " mock-system-header.h"
6
5
#import " ../../Inputs/system-header-simulator-for-objc-dealloc.h"
7
6
8
- @interface Foo : NSObject
7
+ @interface Foo : NSObject {
8
+ const Ref<RefCountable> _obj1;
9
+ const RefPtr<RefCountable> _obj2;
10
+ Ref<RefCountable> _obj3;
11
+ }
9
12
10
13
@property (nonatomic , readonly ) RefPtr<RefCountable> countable;
11
14
@@ -17,6 +20,11 @@ @implementation Foo
17
20
18
21
- (void )execute {
19
22
self._protectedRefCountable ->method ();
23
+ _obj1->method ();
24
+ _obj1.get ().method ();
25
+ (*_obj2).method ();
26
+ _obj3->method ();
27
+ // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
20
28
}
21
29
22
30
- (RefPtr<RefCountable>)_protectedRefCountable {
@@ -30,6 +38,7 @@ - (void)execute {
30
38
void ref () const ;
31
39
void deref () const ;
32
40
Ref<RefCountedObject> copy () const ;
41
+ void method ();
33
42
};
34
43
35
44
@interface WrapperObj : NSObject
You can’t perform that action at this time.
0 commit comments