[PATCH] D146922: [clang-tidy] Fix false positve for defaulted move constructor in performance-noexcept-move-constructor
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 29 10:09:44 PDT 2023
PiotrZSL added a comment.
In D146922#4231317 <https://reviews.llvm.org/D146922#4231317>, @AMS21 wrote:
> In D146922#4227832 <https://reviews.llvm.org/D146922#4227832>, @PiotrZSL wrote:
>
>> Try refactoring code a lite bit, check suggestions, add tests for typedefs, and inheritance from template type.
>
> I'm not quite sure what you mean by tests for typedefs. Maybe you could give me an example?
struct SomeStruct { ... };
using TSomeStruct = SomeStruct;
struct OK {
OK(OK &&) = default;
OK &operator=(OK&&) = default;
TSomeStruct member;
};
struct OK : TSomeStruct {
OK(OK &&) = default;
OK &operator=(OK&&) = default;
};
Anyway, looks promising... I still need to check this more deeply.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp:267
+template <typename T>
+struct OK21 : public T
+{
----------------
for those 2 templates do test with and without instantiation
```
// like this:
void testTemplates() {
OK21<SomeStruct> value(OK21<SomeStruct>());
value = OK21<SomeStruct>();
}
```
,
add test with template as member.
like:
```
template <typename T>
struct OK22
{
OK22(OK22 &&) = default;
OK22 &operator=(OK22 &&) = default;
T member;
};
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146922/new/
https://reviews.llvm.org/D146922
More information about the cfe-commits
mailing list