[PATCH] D146921: [clang-tidy] Implement cppcoreguidelines F.19

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 26 23:37:37 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/ForwardingReferenceParamNotForwardedCheck.cpp:20
+
+AST_MATCHER(Expr, hasUnevaluatedContext) {
+  if (isa<CXXNoexceptExpr>(Node) || isa<RequiresExpr>(Node))
----------------
move this matcher to some utils/...
It may be needed by other checks.



================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/ForwardingReferenceParamNotForwardedCheck.h:32
+  }
+};
+
----------------
ccotter wrote:
> PiotrZSL wrote:
> > add here that thing about UnlessSpelledInSource....
> Sorry, I think I'm missing some context here. Would you mind clarifying your comment?
I mean:
```std::optional<TraversalKind> getCheckTraversalKind() const override {
return TK_IgnoreUnlessSpelledInSource;
}```
just to specify this explicitly..



================
Comment at: clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/forwarding-reference-param-not-forwarded.rst:7
+Warns when a forwarding reference parameter is not forwarded inside the
+function body.
+
----------------
Add link to cpp guidelines, mention rule name like in other checks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:189
    `cppcoreguidelines-avoid-reference-coroutine-parameters <cppcoreguidelines/avoid-reference-coroutine-parameters.html>`_,
+   `cppcoreguidelines-forwarding-reference-param-not-forwarded <cppcoreguidelines/forwarding-reference-param-not-forwarded.html>`_, "Yes"
    `cppcoreguidelines-init-variables <cppcoreguidelines/init-variables.html>`_, "Yes"
----------------
no fixes


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/forwarding-reference-param-not-forwarded.cpp:138
+
+} // namespace negative_cases
----------------
what about when someone uses std::move instead of std::format ?
maybe some "note" for such issue ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146921/new/

https://reviews.llvm.org/D146921



More information about the cfe-commits mailing list