Skip to content

Commit 13b739b

Browse files
committed
Add a nested lambda test case where warning will be emitted
1 parent a50f4d1 commit 13b739b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@ struct RefCountableWithLambdaCapturingThis {
323323
});
324324
});
325325
}
326+
327+
void method_nested_lambda3() {
328+
callAsync([this, protectedThis = RefPtr { this }] {
329+
callAsync([this] {
330+
// expected-warning@-1{{Captured raw-pointer 'this' to ref-counted type or CheckedPtr-capable type is unsafe [webkit.UncountedLambdaCapturesChecker]}}
331+
nonTrivial();
332+
});
333+
});
334+
}
326335
};
327336

328337
struct NonRefCountableWithLambdaCapturingThis {

0 commit comments

Comments
 (0)