[clang] [webkit.UncountedLambdaCapturesChecker] Support [[clang::noescape]] on a constructor (PR #126869)
Rashmi Mudduluru via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 14 13:38:16 PST 2025
================
@@ -106,6 +107,26 @@ class UncountedLambdaCapturesChecker
return safeGetName(NsDecl) == "WTF" && safeGetName(Decl) == "switchOn";
}
+ bool VisitCXXConstructExpr(CXXConstructExpr *CE) override {
+ if (ConstructToIgnore.contains(CE))
+ return true;
+ if (auto *Callee = CE->getConstructor()) {
+ unsigned ArgIndex = 0;
+ for (auto *Param : Callee->parameters()) {
+ if (ArgIndex >= CE->getNumArgs())
+ return true;
+ auto *Arg = CE->getArg(ArgIndex)->IgnoreParenCasts();
+ if (auto *L = findLambdaInArg(Arg)) {
----------------
t-rasmud wrote:
For my understanding: Is the LambdaExpr not covered in `VisitLambdaExpr`? What's special about the expression being an argument to a constructor?
https://github.com/llvm/llvm-project/pull/126869
More information about the cfe-commits
mailing list