File tree 5 files changed +27
-11
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit
5 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ class RawPtrRefCallArgsChecker
264
264
auto *callee = MemberOp->getDirectCallee ();
265
265
if (auto *calleeDecl = dyn_cast<CXXMethodDecl>(callee)) {
266
266
if (const CXXRecordDecl *classDecl = calleeDecl->getParent ()) {
267
- if (isRefCounted (classDecl))
267
+ if (isSafePtr (classDecl))
268
268
return true ;
269
269
}
270
270
}
Original file line number Diff line number Diff line change 1
- // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
1
+ // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncheckedCallArgsChecker -verify %s
2
2
3
3
#include " mock-types.h"
4
4
@@ -10,10 +10,10 @@ namespace call_args_unchecked_uncounted {
10
10
11
11
static void foo () {
12
12
someFunction (makeObj ());
13
- // expected-warning@-1{{Call argument is uncounted and unsafe [alpha.webkit.UncountedCallArgsChecker ]}}
13
+ // expected-warning@-1{{Call argument is unchecked and unsafe [alpha.webkit.UncheckedCallArgsChecker ]}}
14
14
}
15
15
16
- } // namespace call_args_checked
16
+ } // namespace call_args_unchecked_uncounted
17
17
18
18
namespace call_args_checked {
19
19
@@ -35,7 +35,7 @@ static void baz() {
35
35
namespace call_args_default {
36
36
37
37
void someFunction (RefCountableAndCheckable* = makeObj());
38
- // expected-warning@-1{{Call argument is uncounted and unsafe [alpha.webkit.UncountedCallArgsChecker ]}}
38
+ // expected-warning@-1{{Call argument is unchecked and unsafe [alpha.webkit.UncheckedCallArgsChecker ]}}
39
39
void otherFunction (RefCountableAndCheckable* = makeObjChecked().ptr());
40
40
41
41
void foo () {
@@ -44,3 +44,13 @@ void foo() {
44
44
}
45
45
46
46
}
47
+
48
+ namespace call_args_checked_assignment {
49
+
50
+ CheckedObj* provide ();
51
+ void foo () {
52
+ CheckedPtr<CheckedObj> ptr;
53
+ ptr = provide ();
54
+ }
55
+
56
+ }
Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ template <typename T> struct CheckedPtr {
249
249
T *get () const { return t; }
250
250
T *operator ->() const { return t; }
251
251
T &operator *() const { return *t; }
252
- CheckedPtr &operator =(T *) { return * this ; }
252
+ CheckedPtr &operator =(T *);
253
253
operator bool () const { return t; }
254
254
};
255
255
Original file line number Diff line number Diff line change @@ -216,11 +216,7 @@ template <typename T> struct RetainPtr {
216
216
PtrType get () const { return t; }
217
217
PtrType operator->() const { return t; }
218
218
T &operator*() const { return *t; }
219
- RetainPtr &operator=(PtrType t) {
220
- RetainPtr o (t);
221
- swap (o);
222
- return *this;
223
- }
219
+ RetainPtr &operator=(PtrType t);
224
220
PtrType leakRef ()
225
221
{
226
222
PtrType s = t;
Original file line number Diff line number Diff line change @@ -271,6 +271,16 @@ void foo() {
271
271
}
272
272
}
273
273
274
+ namespace cxx_assignment_op {
275
+
276
+ SomeObj* provide ();
277
+ void foo () {
278
+ RetainPtr<SomeObj> ptr;
279
+ ptr = provide ();
280
+ }
281
+
282
+ }
283
+
274
284
namespace call_with_ptr_on_ref {
275
285
RetainPtr<SomeObj> provideProtected ();
276
286
RetainPtr<CFMutableArrayRef > provideProtectedCF ();
You can’t perform that action at this time.
0 commit comments