From 800508b82580fc816ec3ab75dc5cbc8f05260c0c Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 3 May 2018 03:59:50 +0000 Subject: [PATCH] Update to match clang r331428. llvm-svn: 331429 --- .../clang-tidy/modernize/UseNoexceptCheck.cpp | 2 +- .../NoexceptMoveConstructorCheck.cpp | 23 ++++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseNoexceptCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNoexceptCheck.cpp index e32aef92143e..869381ab00dd 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseNoexceptCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseNoexceptCheck.cpp @@ -89,7 +89,7 @@ void UseNoexceptCheck::check(const MatchFinder::MatchResult &Result) { 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() diff --git a/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp b/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp index 86ef70ce0946..111f24d8ebe9 100644 --- a/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp @@ -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(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(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; } } }