File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -504,6 +504,10 @@ class TrivialFunctionAnalysisVisitor
504
504
if (!Callee)
505
505
return false ;
506
506
507
+ auto Name = safeGetName (Callee);
508
+ if (Name == " ref" || Name == " incrementCheckedPtrCount" )
509
+ return true ;
510
+
507
511
std::optional<bool > IsGetterOfRefCounted = isGetterOfSafePtr (Callee);
508
512
if (IsGetterOfRefCounted && *IsGetterOfRefCounted)
509
513
return true ;
Original file line number Diff line number Diff line change @@ -365,3 +365,22 @@ namespace call_with_explicit_temporary_obj {
365
365
CheckedPtr { provide () }->method ();
366
366
}
367
367
}
368
+
369
+ namespace call_with_checked_ptr {
370
+
371
+ class Foo : public CheckedObj {
372
+ public:
373
+ CheckedPtr<CheckedObj> obj1 () { return m_obj; }
374
+ CheckedRef<CheckedObj> obj2 () { return *m_obj; }
375
+ private:
376
+ CheckedObj* m_obj;
377
+ };
378
+
379
+ Foo* getFoo ();
380
+
381
+ void bar () {
382
+ getFoo ()->obj1 ()->method ();
383
+ getFoo ()->obj2 ()->method ();
384
+ }
385
+
386
+ }
Original file line number Diff line number Diff line change @@ -366,6 +366,8 @@ class RefCounted {
366
366
void trivial65 () {
367
367
__libcpp_verbose_abort (" %s" , " aborting" );
368
368
}
369
+ RefPtr<RefCounted> trivial66 () { return children[0 ]; }
370
+ Ref<RefCounted> trivial67 () { return *children[0 ]; }
369
371
370
372
static RefCounted& singleton () {
371
373
static RefCounted s_RefCounted;
@@ -550,6 +552,8 @@ class UnrelatedClass {
550
552
getFieldTrivial ().trivial63 (); // no-warning
551
553
getFieldTrivial ().trivial64 (); // no-warning
552
554
getFieldTrivial ().trivial65 (); // no-warning
555
+ getFieldTrivial ().trivial66 ()->trivial6 (); // no-warning
556
+ getFieldTrivial ().trivial67 ()->trivial6 (); // no-warning
553
557
554
558
RefCounted::singleton ().trivial18 (); // no-warning
555
559
RefCounted::singleton ().someFunction (); // no-warning
You can’t perform that action at this time.
0 commit comments