From 564f1c74b6713ce952be8f683d3ae483ca626f7f Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Fri, 9 Jun 2017 07:34:58 +0000 Subject: [PATCH] Revert "[clang-tidy] When" -fno-exceptions is used", this warning is better to be suppressed." This reverts commit r304949. https://reviews.llvm.org/D34002#775830 llvm-svn: 305057 --- .../misc/NoexceptMoveConstructorCheck.cpp | 2 +- .../misc-noexcept-move-constructor.cpp | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/clang-tools-extra/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp b/clang-tools-extra/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp index 2fdcf75083fb..12a360f4ba73 100644 --- a/clang-tools-extra/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp @@ -20,7 +20,7 @@ namespace misc { void NoexceptMoveConstructorCheck::registerMatchers(MatchFinder *Finder) { // Only register the matchers for C++11; the functionality currently does not // provide any benefit to other languages, despite being benign. - if (!getLangOpts().CPlusPlus11 || !getLangOpts().CXXExceptions) + if (!getLangOpts().CPlusPlus11) return; Finder->addMatcher( diff --git a/clang-tools-extra/test/clang-tidy/misc-noexcept-move-constructor.cpp b/clang-tools-extra/test/clang-tidy/misc-noexcept-move-constructor.cpp index 4072e3f933b6..b8154ec3af15 100644 --- a/clang-tools-extra/test/clang-tidy/misc-noexcept-move-constructor.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-noexcept-move-constructor.cpp @@ -1,25 +1,16 @@ -// RUN: clang-tidy %s -checks="-*,misc-noexcept-move-constructor" -- -std=c++11 \ -// RUN: | FileCheck %s -check-prefix=CHECK-EXCEPTIONS \ -// RUN: -implicit-check-not="{{warning|error}}:" -// RUN: clang-tidy %s -checks="-*,misc-noexcept-move-constructor" -- -fno-exceptions -std=c++11 \ -// RUN: | FileCheck %s -allow-empty -check-prefix=CHECK-NONEXCEPTIONS \ -// RUN: -implicit-check-not="{{warning|error}}:" - +// RUN: %check_clang_tidy %s misc-noexcept-move-constructor %t class A { A(A &&); - // CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: move constructors should be marked noexcept [misc-noexcept-move-constructor] - // CHECK-NONEXCEPTIONS-NOT: warning: + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: move constructors should be marked noexcept [misc-noexcept-move-constructor] A &operator=(A &&); - // CHECK-EXCEPTIONS: :[[@LINE-1]]:6: warning: move assignment operators should - // CHECK-NONEXCEPTIONS-NOT: warning: + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: move assignment operators should }; struct B { static constexpr bool kFalse = false; B(B &&) noexcept(kFalse); - // CHECK-EXCEPTIONS: :[[@LINE-1]]:20: warning: noexcept specifier on the move constructor evaluates to 'false' [misc-noexcept-move-constructor] - // CHECK-NONEXCEPTIONS-NOT: warning: + // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: noexcept specifier on the move constructor evaluates to 'false' [misc-noexcept-move-constructor] }; class OK {};