File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
clang/test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,15 @@ struct RefCountableWithLambdaCapturingThis {
217217 });
218218 }
219219
220+ void method_captures_this_with_other_protected_var () {
221+ RefCountable* x = make_obj ();
222+ call ([this , protectedX = RefPtr { x }]() {
223+ // expected-warning@-1{{Captured raw-pointer 'this' to ref-counted type or CheckedPtr-capable type is unsafe [webkit.UncountedLambdaCapturesChecker]}}
224+ nonTrivial ();
225+ protectedX->method ();
226+ });
227+ }
228+
220229 void method_captures_this_unsafe_capture_local_var_explicitly_with_deref () {
221230 RefCountable* x = make_obj ();
222231 call ([this , protectedThis = Ref { *this }, x]() {
@@ -243,6 +252,13 @@ struct RefCountableWithLambdaCapturingThis {
243252 call (lambda);
244253 }
245254
255+ void method_captures_this_with_guardian_refPtr () {
256+ auto lambda = [this , protectedThis = RefPtr { &*this }]() {
257+ nonTrivial ();
258+ };
259+ call (lambda);
260+ }
261+
246262};
247263
248264struct NonRefCountableWithLambdaCapturingThis {
You can’t perform that action at this time.
0 commit comments