[PATCH] D152825: [clang-tidy] Fix false positive in `readability-named-parameter` for defaulted out-of-line special member functions
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 11:14:12 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92420f4aefbe: [clang-tidy] Fix false positive in `readability-named-parameter` for defaulted… (authored by AMS21, committed by PiotrZSL).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152825/new/
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.530998.patch
Type: text/x-patch
Size: 2076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230613/4318322b/attachment-0001.bin>
More information about the cfe-commits
mailing list