[WebKit checkers] Honor NOESCAPE on a parameter of a type with a trivial destructor (#242582)
webkit.UncountedLambdaCapturesChecker and related checkers reported a
lambda passed to a NOESCAPE parameter of type WTF::ScopedLambda, as in:
bool doBytesMatchMetadataList(..., const FragmentedSharedBuffer* bytes,
...) {
return doBytesMatchMetadataList(tainting, [&](auto algorithm) {
return cryptographicDigestForSharedBuffer(algorithm, bytes);
}, metadataList);
}
findLambdaInArg looked for the lambda in an argument which constructs a
temporary only when the construction was wrapped in a
CXXBindTemporaryExpr. A temporary of a type with a trivial destructor,
such as WTF::ScopedLambda, isn't wrapped in one, so the lambda wasn't
found, and the checker instead saw it passed to ScopedLambda's
converting constructor, whose parameter isn't NOESCAPE.
Look for the lambda in such a construction whether or not it's wrapped
in a CXXBindTemporaryExpr.
Co-authored with Claude.
rdar://192641679