================ @@ -89,7 +182,25 @@ class UncountedLambdaCapturesChecker } printQuotedQualifiedName(Os, Capture.getCapturedVar()); - Os << " to uncounted type is unsafe."; + Os << " to ref-counted / CheckedPtr capable type is unsafe."; + + PathDiagnosticLocation BSLoc(Capture.getLocation(), BR->getSourceManager()); + auto Report = std::make_unique<BasicBugReport>(Bug, Os.str(), BSLoc); + BR->emitReport(std::move(Report)); + } + + void reportBugOnThisPtr(const LambdaCapture &Capture) const { + SmallString<100> Buf; + llvm::raw_svector_ostream Os(Buf); + + if (Capture.isExplicit()) { + Os << "Captured "; + } else { + Os << "Implicitly captured "; + } + + Os << "raw-pointer 'this' to ref-counted / CheckedPtr capable type is " ---------------- t-rasmud wrote:
nit: Can this warning be better worded? `.. ref-counted (or CheckedPtr capable) type ...`? Or anything else that conveys that it's unsafe to capture raw-pointer to a ref-counted type or a "CheckedPtr capable" type. https://github.com/llvm/llvm-project/pull/114897 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits