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")
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")
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits