[PATCH] D31049: [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted declarations

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 17 09:52:50 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL298101: [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted… (authored by alexfh).

Changed prior to commit:
  https://reviews.llvm.org/D31049?vs=92037&id=92159#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31049

Files:
  clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-noexcept-move-constructor.cpp


Index: clang-tools-extra/trunk/test/clang-tidy/misc-noexcept-move-constructor.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-noexcept-move-constructor.cpp
+++ clang-tools-extra/trunk/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-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
@@ -43,6 +43,10 @@
     }
 
     const auto *ProtoType = Decl->getType()->getAs<FunctionProtoType>();
+
+    if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
+      return;
+
     switch (ProtoType->getNoexceptSpec(*Result.Context)) {
       case FunctionProtoType::NR_NoNoexcept:
         diag(Decl->getLocation(), "move %0s should be marked noexcept")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31049.92159.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170317/aaabd098/attachment.bin>


More information about the cfe-commits mailing list