edyp87 created this revision.
edyp87 added a project: clang-tools-extra.
Herald added a subscriber: JDevlieghere.
There is no need for triggering warning when noexcept specifier in move
constructor or move-assignment operator is neither evaluated nor uninstantiated.
This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712
Repository:
rL LLVM
https://reviews.llvm.org/D31049
Files:
clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
test/clang-tidy/misc-noexcept-move-constructor.cpp
Index: test/clang-tidy/misc-noexcept-move-constructor.cpp
===
--- test/clang-tidy/misc-noexcept-move-constructor.cpp
+++ test/clang-tidy/misc-noexcept-move-constructor.cpp
@@ -42,3 +42,13 @@
OK3(OK3 &&) noexcept(false) {}
OK3 &operator=(OK3 &&) = delete;
};
+
+struct OK4 {
+ OK4(OK4 &&) noexcept = default;
+ OK4 &operator=(OK4 &&) noexcept = default;
+};
+
+struct OK5 {
+ OK5(OK5 &&) noexcept(true) = default;
+ OK5 &operator=(OK5 &&) noexcept(true) = default;
+};
Index: clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
===
--- clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
+++ clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
@@ -43,6 +43,10 @@
}
const auto *ProtoType = Decl->getType()->getAs();
+
+if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
+ return;
+
switch (ProtoType->getNoexceptSpec(*Result.Context)) {
case FunctionProtoType::NR_NoNoexcept:
diag(Decl->getLocation(), "move %0s should be marked noexcept")
Index: test/clang-tidy/misc-noexcept-move-constructor.cpp
===
--- test/clang-tidy/misc-noexcept-move-constructor.cpp
+++ test/clang-tidy/misc-noexcept-move-constructor.cpp
@@ -42,3 +42,13 @@
OK3(OK3 &&) noexcept(false) {}
OK3 &operator=(OK3 &&) = delete;
};
+
+struct OK4 {
+ OK4(OK4 &&) noexcept = default;
+ OK4 &operator=(OK4 &&) noexcept = default;
+};
+
+struct OK5 {
+ OK5(OK5 &&) noexcept(true) = default;
+ OK5 &operator=(OK5 &&) noexcept(true) = default;
+};
Index: clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
===
--- clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
+++ clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
@@ -43,6 +43,10 @@
}
const auto *ProtoType = Decl->getType()->getAs();
+
+if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
+ return;
+
switch (ProtoType->getNoexceptSpec(*Result.Context)) {
case FunctionProtoType::NR_NoNoexcept:
diag(Decl->getLocation(), "move %0s should be marked noexcept")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits