[PATCH] D152825: [clang-tidy] Fix false positive in `readability-named-parameter` for defaulted out-of-line special member functionsThis fixes llvm#63056
André Schackier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 09:12:58 PDT 2023
AMS21 created this revision.
AMS21 added reviewers: PiotrZSL, njames93, carlosgalvezp, eugene.
Herald added a subscriber: xazax.hun.
Herald added a project: All.
AMS21 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152825
Files:
clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
Index: clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
@@ -131,3 +131,20 @@
typedef void (F)(int);
F f;
void f(int x) {}
+
+namespace issue_63056
+{
+ struct S {
+ S(const S&);
+ S(S&&);
+
+ S& operator=(const S&);
+ S& operator=(S&&);
+ };
+
+ S::S(const S&) = default;
+ S::S(S&&) = default;
+
+ S& S::operator=(const S&) = default;
+ S& S::operator=(S&&) = default;
+} // namespace issue_63056
Index: clang-tools-extra/docs/ReleaseNotes.rst
===================================================================
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -396,6 +396,10 @@
<clang-tidy/checks/readability/misleading-indentation>` check when warning would
be unnecessarily emitted for template dependent ``if constexpr``.
+- Fixed a false positive in :doc:`readability-named-parameter
+ <clang-tidy/checks/readability/named-parameter>` for defaulted out-of-line
+ special member functions.
+
- Fixed incorrect fixes in :doc:`readability-redundant-declaration
<clang-tidy/checks/readability/redundant-declaration>` check when linkage
(like ``extern "C"``) is explicitly specified.
Index: clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
@@ -28,7 +28,7 @@
// overriden method.
const FunctionDecl *Definition = nullptr;
if ((!Function->isDefined(Definition) || Function->isDefaulted() ||
- Function->isDeleted()) &&
+ Definition->isDefaulted() || Function->isDeleted()) &&
(!isa<CXXMethodDecl>(Function) ||
cast<CXXMethodDecl>(Function)->size_overridden_methods() == 0))
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152825.530933.patch
Type: text/x-patch
Size: 2076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230613/0d4776ba/attachment-0001.bin>
More information about the cfe-commits
mailing list