[clang-tools-extra] [clang-tidy] Add support for lambda-expression in `use-trailing-return-type` check (PR #135383)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 09:40:14 PDT 2025


================
@@ -56,6 +60,13 @@ class UseTrailingReturnTypeCheck : public ClangTidyCheck {
                       SourceRange ReturnTypeCVRange, const FunctionDecl &F,
                       const FriendDecl *Fr, const ASTContext &Ctx,
                       const SourceManager &SM, const LangOptions &LangOpts);
+
+  void diagOnLambda(const LambdaExpr *Lambda,
+                    const ast_matchers::MatchFinder::MatchResult &Result);
+  SourceLocation findLambdaTrailingReturnInsertLoc(const CXXMethodDecl *Method,
+                                                   const SourceManager &SM,
+                                                   const LangOptions &LangOpts,
+                                                   const ASTContext &Ctx);
----------------
vbvictor wrote:

Thank you for pointing out, actually almost all `private` methods could be converted to `static` functions with minimal changes except for `diagOnLambda` because it uses `ClangTidyCheck::diag` method and I don't think we need to convert it.

https://github.com/llvm/llvm-project/pull/135383


More information about the cfe-commits mailing list