[PATCH] D28973: Supresses misc-move-constructor-init warning for const fields.
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 8 07:07:45 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294459: [clang-tidy] Supresses misc-move-constructor-init warning for const fields. (authored by alexfh).
Changed prior to commit:
https://reviews.llvm.org/D28973?vs=87484&id=87655#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28973
Files:
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
Index: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
@@ -57,6 +57,9 @@
if (QT.isTriviallyCopyableType(*Result.Context))
return;
+ if (QT.isConstQualified())
+ return;
+
const auto *RD = QT->getAsCXXRecordDecl();
if (RD && RD->isTriviallyCopyable())
return;
Index: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
@@ -84,6 +84,16 @@
N(N &&RHS) : Mem(move(RHS.Mem)) {}
};
+struct O {
+ O(O&& other) : b(other.b) {} // ok
+ const B b;
+};
+
+struct P {
+ P(O&& other) : b(other.b) {} // ok
+ B b;
+};
+
struct Movable {
Movable(Movable &&) = default;
Movable(const Movable &) = default;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28973.87655.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170208/ad544a8e/attachment.bin>
More information about the cfe-commits
mailing list