9 Commits

Author SHA1 Message Date
Baranov Victor
5325f2b930
[clang-tidy][NFC] Enable 'performance-move-const-arg' in '.clang-tidy' config (#148549)
Set `performance-move-const-arg.CheckTriviallyCopyableMove` option to
`false` because "trivially copyable" is too strict and give warning for
e.g. `MixData` class:
1fbfa333f6/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp (L389)
Here:

1fbfa333f6/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp (L504-L505)
I find `std::move` here useful.
2025-08-03 13:18:24 +03:00
Baranov Victor
d7a17540f8
[clang-tidy][NFC] add '.clang-tidy' config for clang-tidy project (#147793)
Added `.clang-tidy` config as discussed in
[RFC](https://discourse.llvm.org/t/rfc-create-hardened-clang-tidy-config-for-clang-tidy-directory/87247).
Added `bugprone`, `readability`, `modernize`, `performance` checks that
didn't create many warnings.
Fixed minor warnings to make `/clang-tidy` directory complaint with
`clang-tidy-20`.

Disabled checks will be enabled in future PRs after fixing their
warnings.
2025-07-11 17:17:59 +03:00
Dimitrije Dobrota
6a57af8d03
[clang-tidy] Add flag to specify an alternative to std::forward (#138755)
Since std::forward is nothing more than a cast, part of STL and not the
language itself, it's easy to provide a custom implementation if one
wishes not to include the entirety of <utility>.

Added flag (ForwardFunction) provides a way to continue using this
essential check even with the custom implementation of forwarding.

---------

Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
2025-06-30 22:13:33 +03:00
Yanzuo Liu
b7db2e1fc0
[Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (#138504)
Remove `CaptureInCopy` because the cases handled by it are covered by
`CaptureByRefExplicit`.
2025-05-07 21:39:31 +02:00
Danny Mösch
16b3e43a03
[clang-tidy] Ignore non-forwarded arguments if they are unused (#87832) 2024-04-08 23:54:29 +02:00
Qizhi Hu
8b326d5946
[clang-tidy] fix false negative in cppcoreguidelines-missing-std-forward (#83987)
Try to fix https://github.com/llvm/llvm-project/issues/83845
When `std::forward` is invoked in a function, make sure it uses correct
parameter by checking if the bounded `var` equals the parameter.

Co-authored-by: huqizhi <836744285@qq.com>
2024-03-06 09:27:32 +08:00
AMS21
7b11e2ec39
[clang-tidy] Fix cppcoreguidelines-missing-std-forward false positive for deleted functions (#83055)
Improved check by no longer giving false positives for deleted functions.
2024-02-27 19:35:11 +01:00
Qizhi Hu
d08482924e
[clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (#77056)
Parameter variable which is forwarded in lambda capture list or in body
by reference is reasonable and current version of this check produces
false positive on these cases. This patch try to fix the
[issue](https://github.com/llvm/llvm-project/issues/68105)

Co-authored-by: huqizhi <836744285@qq.com>
2024-01-06 19:50:00 +08:00
Chris Cotter
5902bb9584 [clang-tidy] Implement cppcoreguidelines F.19
Warns when a function accepting a forwarding reference does anything besides
forwarding (with std::forward) the parameter in the body of the function.

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D146921
2023-05-06 10:49:23 +00:00