File tree 2 files changed +20
-0
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,11 @@ bool tryToFindPtrOrigin(
101
101
if (isSingleton (callee))
102
102
return callback (E, true );
103
103
104
+ if (callee->isInStdNamespace () && safeGetName (callee) == " forward" ) {
105
+ E = call->getArg (0 );
106
+ continue ;
107
+ }
108
+
104
109
if (isPtrConversion (callee)) {
105
110
E = call->getArg (0 );
106
111
continue ;
Original file line number Diff line number Diff line change @@ -588,6 +588,8 @@ class UnrelatedClass {
588
588
getFieldTrivial ().nonTrivial23 ();
589
589
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
590
590
}
591
+
592
+ void setField (RefCounted*);
591
593
};
592
594
593
595
class UnrelatedClass2 {
@@ -598,11 +600,24 @@ class UnrelatedClass2 {
598
600
RefCounted &getFieldTrivialRecursively () { return getFieldTrivial ().getFieldTrivial (); }
599
601
RefCounted *getFieldTrivialTernary () { return Field ? Field->getFieldTernary () : nullptr ; }
600
602
603
+ template <typename T, typename ... AdditionalArgs>
604
+ void callSetField (T&& item, AdditionalArgs&&... args)
605
+ {
606
+ item.setField (std::forward<AdditionalArgs>(args)...);
607
+ }
608
+
609
+ template <typename T, typename ... AdditionalArgs>
610
+ void callSetField2 (T&& item, AdditionalArgs&&... args)
611
+ {
612
+ item.setField (std::move<AdditionalArgs>(args)...);
613
+ }
614
+
601
615
void test () {
602
616
getFieldTrivialRecursively ().trivial1 (); // no-warning
603
617
getFieldTrivialTernary ()->trivial2 (); // no-warning
604
618
getFieldTrivialRecursively ().someFunction ();
605
619
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
620
+ callSetField (getFieldTrivial (), refCountedObj ()); // no-warning
606
621
}
607
622
};
608
623
You can’t perform that action at this time.
0 commit comments