[clang-tools-extra] r331429 - Update to match clang r331428.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed May 2 20:59:50 PDT 2018


Author: rsmith
Date: Wed May  2 20:59:50 2018
New Revision: 331429

URL: http://llvm.org/viewvc/llvm-project?rev=331429&view=rev
Log:
Update to match clang r331428.

Modified:
    clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp
    clang-tools-extra/trunk/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp?rev=331429&r1=331428&r2=331429&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp Wed May  2 20:59:50 2018
@@ -89,7 +89,7 @@ void UseNoexceptCheck::check(const Match
       Result.Context->getLangOpts());
 
   assert(FnTy && "FunctionProtoType is null.");
-  bool IsNoThrow = FnTy->isNothrow(*Result.Context);
+  bool IsNoThrow = FnTy->isNothrow();
   StringRef ReplacementStr =
       IsNoThrow
           ? NoexceptMacro.empty() ? "noexcept" : NoexceptMacro.c_str()

Modified: clang-tools-extra/trunk/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp?rev=331429&r1=331428&r2=331429&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp Wed May  2 20:59:50 2018
@@ -47,27 +47,22 @@ void NoexceptMoveConstructorCheck::check
     if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
       return;
 
-    switch (ProtoType->getNoexceptSpec(*Result.Context)) {
-    case FunctionProtoType::NR_NoNoexcept:
+    if (!isNoexceptExceptionSpec(ProtoType->getExceptionSpecType())) {
       diag(Decl->getLocation(), "move %0s should be marked noexcept")
           << MethodType;
       // FIXME: Add a fixit.
-      break;
-    case FunctionProtoType::NR_Throw:
-      // Don't complain about nothrow(false), but complain on nothrow(expr)
-      // where expr evaluates to false.
-      if (const Expr *E = ProtoType->getNoexceptExpr()) {
-        if (isa<CXXBoolLiteralExpr>(E))
-          break;
+      return;
+    }
+
+    // Don't complain about nothrow(false), but complain on nothrow(expr)
+    // where expr evaluates to false.
+    if (ProtoType->canThrow() == CT_Can) {
+      Expr *E = ProtoType->getNoexceptExpr();
+      if (!isa<CXXBoolLiteralExpr>(ProtoType->getNoexceptExpr())) {
         diag(E->getExprLoc(),
              "noexcept specifier on the move %0 evaluates to 'false'")
             << MethodType;
       }
-      break;
-    case FunctionProtoType::NR_Nothrow:
-    case FunctionProtoType::NR_Dependent:
-    case FunctionProtoType::NR_BadNoexcept:
-      break;
     }
   }
 }




More information about the cfe-commits mailing list