<div dir="ltr">It looks like the buildbots have exceptions turned off by default, so the tests need to use `-fexceptions` explicitly. Testing a fix...</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 8, 2017 at 11:26 PM, Galina Kistanova <span dir="ltr"><<a href="mailto:gkistanova@gmail.com" target="_blank">gkistanova@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Alexander,<br><br>Couple of our builders do not like this commit:<br><br>Failing Tests:<br><br>    Clang Tools :: clang-tidy/modernize-use-<wbr>noexcept-opt.cpp<br>    Clang Tools :: clang-tidy/modernize-use-<wbr>noexcept.cpp<br><br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/12431" target="_blank">http://lab.llvm.org:8011/<wbr>builders/llvm-clang-lld-x86_<wbr>64-scei-ps4-ubuntu-fast/<wbr>builds/12431</a><br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast" target="_blank">http://lab.llvm.org:8011/<wbr>builders/llvm-clang-lld-x86_<wbr>64-scei-ps4-windows10pro-fast</a><br><br>Please have a look at this?<br><br>Thanks<span class="HOEnZb"><font color="#888888"><br><br>Galina<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 8, 2017 at 7:04 AM, Alexander Kornienko via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: alexfh<br>
Date: Thu Jun  8 09:04:16 2017<br>
New Revision: 304977<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=304977&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=304977&view=rev</a><br>
Log:<br>
[clang-tidy] New checker to replace dynamic exception specifications<br>
<br>
Summary:<br>
New checker to replace dynamic exception<br>
specifications<br>
<br>
This is an alternative to D18575 which relied on reparsing the decl to<br>
find the location of dynamic exception specifications, but couldn't<br>
deal with preprocessor conditionals correctly without reparsing the<br>
entire file.<br>
<br>
This approach uses D20428 to find dynamic exception specification<br>
locations and handles all cases correctly.<br>
<br>
Reviewers: aaron.ballman, alexfh<br>
<br>
Reviewed By: aaron.ballman, alexfh<br>
<br>
Subscribers: xazax.hun, mgehre, malcolm.parsons, mgorny, JDevlieghere, cfe-commits, Eugene.Zelenko, etienneb<br>
<br>
Patch by Don Hinton!<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D20693" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2069<wbr>3</a><br>
<br>
Added:<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.cpp<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.h<br>
    clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/modernize-use<wbr>-noexcept.rst<br>
    clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-macro.cpp<br>
    clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-opt.cpp<br>
    clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt.cpp<br>
Modified:<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/modernize/CMakeLists.txt<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/modernize/ModernizeTidyMo<wbr>dule.cpp<br>
    clang-tools-extra/trunk/docs/R<wbr>eleaseNotes.rst<br>
    clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/modernize/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt?rev=304977&r1=304976&r2=304977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/modernize/CMakeList<wbr>s.txt?rev=304977&r1=304976&r2=<wbr>304977&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/modernize/CMakeLists.txt (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/modernize/CMakeLists.txt Thu Jun  8 09:04:16 2017<br>
@@ -22,6 +22,7 @@ add_clang_library(clangTidyMod<wbr>ernizeModu<br>
   UseEmplaceCheck.cpp<br>
   UseEqualsDefaultCheck.cpp<br>
   UseEqualsDeleteCheck.cpp<br>
+  UseNoexceptCheck.cpp<br>
   UseNullptrCheck.cpp<br>
   UseOverrideCheck.cpp<br>
   UseTransparentFunctorsCheck.c<wbr>pp<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/modernize/ModernizeTidyMo<wbr>dule.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=304977&r1=304976&r2=304977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/modernize/Modernize<wbr>TidyModule.cpp?rev=304977&r1=<wbr>304976&r2=304977&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/modernize/ModernizeTidyMo<wbr>dule.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/modernize/ModernizeTidyMo<wbr>dule.cpp Thu Jun  8 09:04:16 2017<br>
@@ -28,6 +28,7 @@<br>
 #include "UseEmplaceCheck.h"<br>
 #include "UseEqualsDefaultCheck.h"<br>
 #include "UseEqualsDeleteCheck.h"<br>
+#include "UseNoexceptCheck.h"<br>
 #include "UseNullptrCheck.h"<br>
 #include "UseOverrideCheck.h"<br>
 #include "UseTransparentFunctorsCheck.h<wbr>"<br>
@@ -69,6 +70,7 @@ public:<br>
     CheckFactories.registerCheck<<wbr>UseEqualsDefaultCheck>("modern<wbr>ize-use-equals-default");<br>
     CheckFactories.registerCheck<<wbr>UseEqualsDeleteCheck>(<br>
         "modernize-use-equals-delete"<wbr>);<br>
+    CheckFactories.registerCheck<U<wbr>seNoexceptCheck>("modernize-us<wbr>e-noexcept");<br>
     CheckFactories.registerCheck<<wbr>UseNullptrCheck>("modernize-us<wbr>e-nullptr");<br>
     CheckFactories.registerCheck<<wbr>UseOverrideCheck>("modernize-u<wbr>se-override");<br>
     CheckFactories.registerCheck<<wbr>UseTransparentFunctorsCheck>(<br>
<br>
Added: clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp?rev=304977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/modernize/UseNoexce<wbr>ptCheck.cpp?rev=304977&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.cpp (added)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.cpp Thu Jun  8 09:04:16 2017<br>
@@ -0,0 +1,114 @@<br>
+//===--- UseNoexceptCheck.cpp - clang-tidy--------------------<wbr>-------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+#include "UseNoexceptCheck.h"<br>
+#include "clang/AST/ASTContext.h"<br>
+#include "clang/Lex/Lexer.h"<br>
+<br>
+using namespace clang::ast_matchers;<br>
+<br>
+namespace clang {<br>
+namespace tidy {<br>
+namespace modernize {<br>
+<br>
+UseNoexceptCheck::UseNoexcept<wbr>Check(StringRef Name, ClangTidyContext *Context)<br>
+    : ClangTidyCheck(Name, Context),<br>
+      NoexceptMacro(Options.get("Rep<wbr>lacementString", "")),<br>
+      UseNoexceptFalse(Options.get("<wbr>UseNoexceptFalse", true)) {}<br>
+<br>
+void UseNoexceptCheck::storeOptions<wbr>(ClangTidyOptions::OptionMap &Opts) {<br>
+  Options.store(Opts, "ReplacementString", NoexceptMacro);<br>
+  Options.store(Opts, "UseNoexceptFalse", UseNoexceptFalse);<br>
+}<br>
+<br>
+void UseNoexceptCheck::registerMatc<wbr>hers(MatchFinder *Finder) {<br>
+  if (!getLangOpts().CPlusPlus11)<br>
+    return;<br>
+<br>
+  Finder->addMatcher(<br>
+      functionDecl(<br>
+          cxxMethodDecl(<br>
+              hasTypeLoc(loc(functionProtoTy<wbr>pe(hasDynamicExceptionSpec()))<wbr>),<br>
+              anyOf(hasOverloadedOperatorNam<wbr>e("delete[]"),<br>
+                    hasOverloadedOperatorName("del<wbr>ete"), cxxDestructorDecl()))<br>
+              .bind("del-dtor"))<br>
+          .bind("funcDecl"),<br>
+      this);<br>
+<br>
+  Finder->addMatcher(<br>
+      functionDecl(<br>
+          hasTypeLoc(loc(functionProtoTy<wbr>pe(hasDynamicExceptionSpec()))<wbr>),<br>
+          unless(anyOf(hasOverloadedOper<wbr>atorName("delete[]"),<br>
+                       hasOverloadedOperatorName("de<wbr>lete"),<br>
+                       cxxDestructorDecl())))<br>
+          .bind("funcDecl"),<br>
+      this);<br>
+<br>
+  Finder->addMatcher(<br>
+      parmVarDecl(anyOf(hasType(poin<wbr>terType(pointee(parenType(inne<wbr>rType(<br>
+                            functionProtoType(hasDynamicEx<wbr>ceptionSpec())))))),<br>
+                        hasType(memberPointerType(poin<wbr>tee(parenType(innerType(<br>
+                            functionProtoType(hasDynamicEx<wbr>ceptionSpec()))))))))<br>
+          .bind("parmVarDecl"),<br>
+      this);<br>
+}<br>
+<br>
+void UseNoexceptCheck::check(const MatchFinder::MatchResult &Result) {<br>
+  const FunctionProtoType *FnTy = nullptr;<br>
+  bool DtorOrOperatorDel = false;<br>
+  SourceRange Range;<br>
+<br>
+  if (const auto *FuncDecl = Result.Nodes.getNodeAs<Functio<wbr>nDecl>("funcDecl")) {<br>
+    DtorOrOperatorDel = Result.Nodes.getNodeAs<Functio<wbr>nDecl>("del-dtor");<br>
+    FnTy = FuncDecl->getType()->getAs<Fun<wbr>ctionProtoType>();<br>
+    if (const auto *TSI = FuncDecl->getTypeSourceInfo())<br>
+      Range =<br>
+          TSI->getTypeLoc().castAs<Funct<wbr>ionTypeLoc>().getExceptionSpec<wbr>Range();<br>
+  } else if (const auto *ParmDecl =<br>
+                 Result.Nodes.getNodeAs<ParmVa<wbr>rDecl>("parmVarDecl")) {<br>
+    FnTy = ParmDecl->getType()<br>
+               ->getAs<Type>()<br>
+               ->getPointeeType()<br>
+               ->getAs<FunctionProtoType>();<br>
+<br>
+    if (const auto *TSI = ParmDecl->getTypeSourceInfo())<br>
+      Range = TSI->getTypeLoc()<br>
+                  .getNextTypeLoc()<br>
+                  .IgnoreParens()<br>
+                  .castAs<FunctionProtoTypeLoc>(<wbr>)<br>
+                  .getExceptionSpecRange();<br>
+  }<br>
+  CharSourceRange CRange = Lexer::makeFileCharRange(<br>
+      CharSourceRange::getTokenRange<wbr>(Range), *Result.SourceManager,<br>
+      Result.Context->getLangOpts())<wbr>;<br>
+<br>
+  assert(FnTy && "FunctionProtoType is null.");<br>
+  bool IsNoThrow = FnTy->isNothrow(*Result.Contex<wbr>t);<br>
+  StringRef ReplacementStr =<br>
+      IsNoThrow<br>
+          ? NoexceptMacro.empty() ? "noexcept" : NoexceptMacro.c_str()<br>
+          : NoexceptMacro.empty()<br>
+                ? (DtorOrOperatorDel || UseNoexceptFalse) ? "noexcept(false)"<br>
+                                                          : ""<br>
+                : "";<br>
+<br>
+  FixItHint FixIt;<br>
+  if ((IsNoThrow || NoexceptMacro.empty()) && CRange.isValid())<br>
+    FixIt = FixItHint::CreateReplacement(C<wbr>Range, ReplacementStr);<br>
+<br>
+  diag(Range.getBegin(), "dynamic exception specification '%0' is deprecated; "<br>
+                         "consider %select{using '%2'|removing it}1 instead")<br>
+      << Lexer::getSourceText(CRange, *Result.SourceManager,<br>
+                              Result.Context->getLangOpts())<br>
+      << ReplacementStr.empty() << ReplacementStr << FixIt;<br>
+}<br>
+<br>
+} // namespace modernize<br>
+} // namespace tidy<br>
+} // namespace clang<br>
<br>
Added: clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.h?rev=304977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/modernize/UseNoexce<wbr>ptCheck.h?rev=304977&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.h (added)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/modernize/UseNoexceptChec<wbr>k.h Thu Jun  8 09:04:16 2017<br>
@@ -0,0 +1,49 @@<br>
+//===--- UseNoexceptCheck.h - clang-tidy--------------------<wbr>-----*- C++ -*-===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_T<wbr>IDY_MODERNIZE_USE_NOEXCEPT_H<br>
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_T<wbr>IDY_MODERNIZE_USE_NOEXCEPT_H<br>
+<br>
+#include "../ClangTidy.h"<br>
+<br>
+namespace clang {<br>
+namespace tidy {<br>
+namespace modernize {<br>
+<br>
+/// \brief Replace dynamic exception specifications, with<br>
+/// `noexcept` (or user-defined macro) or `noexcept(false)`.<br>
+/// \code<br>
+///   void foo() throw();<br>
+///   void bar() throw(int);<br>
+/// \endcode<br>
+/// Is converted to:<br>
+/// \code<br>
+///   void foo() ;<br>
+//    void bar() noexcept(false);<br>
+/// \endcode<br>
+///<br>
+/// For the user-facing documentation see:<br>
+/// <a href="http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html" rel="noreferrer" target="_blank">http://clang.llvm.org/extra/cl<wbr>ang-tidy/checks/modernize-use-<wbr>noexcept.html</a><br>
+class UseNoexceptCheck : public ClangTidyCheck {<br>
+public:<br>
+  UseNoexceptCheck(StringRef Name, ClangTidyContext *Context);<br>
+  void storeOptions(ClangTidyOptions:<wbr>:OptionMap &Opts) override;<br>
+  void registerMatchers(ast_matchers:<wbr>:MatchFinder *Finder) override;<br>
+  void check(const ast_matchers::MatchFinder::Mat<wbr>chResult &Result) override;<br>
+<br>
+private:<br>
+  const std::string NoexceptMacro;<br>
+  bool UseNoexceptFalse;<br>
+};<br>
+<br>
+} // namespace modernize<br>
+} // namespace tidy<br>
+} // namespace clang<br>
+<br>
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_T<wbr>IDY_MODERNIZE_USE_NOEXCEPT_H<br>
<br>
Modified: clang-tools-extra/trunk/docs/R<wbr>eleaseNotes.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=304977&r1=304976&r2=304977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>docs/ReleaseNotes.rst?rev=<wbr>304977&r1=304976&r2=304977&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/docs/R<wbr>eleaseNotes.rst (original)<br>
+++ clang-tools-extra/trunk/docs/R<wbr>eleaseNotes.rst Thu Jun  8 09:04:16 2017<br>
@@ -100,6 +100,11 @@ Improvements to clang-tidy<br>
   to remove user-defined make functions from ``push_back`` calls on containers<br>
   of custom tuple-like types by providing `TupleTypes` and `TupleMakeFunctions`.<br>
<br>
+ - New `modernize-use-noexcept<br>
+   <<a href="http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html" rel="noreferrer" target="_blank">http://clang.llvm.org/extra/<wbr>clang-tidy/checks/modernize-us<wbr>e-noexcept.html</a>>`_ check<br>
+<br>
+   Replaces dynamic exception specifications with ``noexcept`` or a user defined macro.<br>
+<br>
 - New `performance-inefficient-vecto<wbr>r-operation<br>
   <<a href="http://clang.llvm.org/extra/clang-tidy/checks/performance-inefficient-vector-operation.html" rel="noreferrer" target="_blank">http://clang.llvm.org/extra/<wbr>clang-tidy/checks/performance-<wbr>inefficient-vector-operation.h<wbr>tml</a>>`_ check<br>
<br>
<br>
Modified: clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=304977&r1=304976&r2=304977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>docs/clang-tidy/checks/list.<wbr>rst?rev=304977&r1=304976&r2=<wbr>304977&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst (original)<br>
+++ clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst Thu Jun  8 09:04:16 2017<br>
@@ -135,6 +135,7 @@ Clang-Tidy Checks<br>
    modernize-use-emplace<br>
    modernize-use-equals-default<br>
    modernize-use-equals-delete<br>
+   modernize-use-noexcept<br>
    modernize-use-nullptr<br>
    modernize-use-override<br>
    modernize-use-transparent-func<wbr>tors<br>
<br>
Added: clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/modernize-use<wbr>-noexcept.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-noexcept.rst?rev=304977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>docs/clang-tidy/checks/moderni<wbr>ze-use-noexcept.rst?rev=<wbr>304977&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/modernize-use<wbr>-noexcept.rst (added)<br>
+++ clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/modernize-use<wbr>-noexcept.rst Thu Jun  8 09:04:16 2017<br>
@@ -0,0 +1,90 @@<br>
+.. title:: clang-tidy - modernize-use-noexcept<br>
+<br>
+modernize-use-noexcept<br>
+======================<br>
+<br>
+This check replaces deprecated dynamic exception specifications with<br>
+the appropriate noexcept specification (introduced in C++11).  By<br>
+default this check will replace ``throw()`` with ``noexcept``,<br>
+and ``throw(<exception>[,...])`` or ``throw(...)`` with<br>
+``noexcept(false)``.<br>
+<br>
+Example<br>
+-------<br>
+<br>
+.. code-block:: c++<br>
+<br>
+  void foo() throw();<br>
+       void bar() throw(int) {}<br>
+<br>
+transforms to:<br>
+<br>
+.. code-block:: c++<br>
+<br>
+  void foo() noexcept;<br>
+       void bar() noexcept(false) {}<br>
+<br>
+Options<br>
+-------<br>
+<br>
+.. option:: ReplacementString<br>
+<br>
+Users can use :option:`ReplacementString` to specify a macro to use<br>
+instead of ``noexcept``.  This is useful when maintaining source code<br>
+that uses custom exception specification marking other than<br>
+``noexcept``.  Fix-it hints will only be generated for non-throwing<br>
+specifications.<br>
+<br>
+Example<br>
+^^^^^^^<br>
+<br>
+.. code-block:: c++<br>
+<br>
+  void bar() throw(int);<br>
+  void foo() throw();<br>
+<br>
+transforms to:<br>
+<br>
+.. code-block:: c++<br>
+<br>
+  void bar() throw(int);  // No fix-it generated.<br>
+  void foo() NOEXCEPT;<br>
+<br>
+if the :option:`ReplacementString` option is set to `NOEXCEPT`.<br>
+<br>
+.. option:: UseNoexceptFalse<br>
+<br>
+Enabled by default, disabling will generate fix-it hints that remove<br>
+throwing dynamic exception specs, e.g., ``throw(<something>)``,<br>
+completely without providing a replacement text, except for<br>
+destructors and delete operators that are ``noexcept(true)`` by<br>
+default.<br>
+<br>
+Example<br>
+^^^^^^^<br>
+<br>
+.. code-block:: c++<br>
+<br>
+  void foo() throw(int) {}<br>
+<br>
+  struct bar {<br>
+    void foobar() throw(int);<br>
+    void operator delete(void *ptr) throw(int);<br>
+    void operator delete[](void *ptr) throw(int);<br>
+    ~bar() throw(int);<br>
+  }<br>
+<br>
+transforms to:<br>
+<br>
+.. code-block:: c++<br>
+<br>
+  void foo() {}<br>
+<br>
+  struct bar {<br>
+    void foobar();<br>
+    void operator delete(void *ptr) noexcept(false);<br>
+    void operator delete[](void *ptr) noexcept(false);<br>
+    ~bar() noexcept(false);<br>
+  }<br>
+<br>
+if the :option:`UseNoexceptFalse` option is set to `0`.<br>
<br>
Added: clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-macro.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-noexcept-macro.cpp?rev=304977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>test/clang-tidy/modernize-use-<wbr>noexcept-macro.cpp?rev=304977&<wbr>view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-macro.cpp (added)<br>
+++ clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-macro.cpp Thu Jun  8 09:04:16 2017<br>
@@ -0,0 +1,36 @@<br>
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \<br>
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.Replace<wbr>mentString, value: 'NOEXCEPT'}]}" \<br>
+// RUN:   -- -std=c++11<br>
+<br>
+// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported.<br>
+#if (__has_feature(cxx_noexcept))<br>
+#define NOEXCEPT noexcept<br>
+#else<br>
+#define NOEXCEPT throw()<br>
+#endif<br>
+<br>
+void bar() throw() {}<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'NOEXCEPT' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void bar() NOEXCEPT {}<br>
+<br>
+// Should not trigger a FixItHint, since macros only support noexcept, and this<br>
+// case throws.<br>
+class A {};<br>
+class B {};<br>
+void foobar() throw(A, B);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+<br>
+// Should not trigger a replacement.<br>
+void foo() noexcept(true);<br>
+<br>
+struct Z {<br>
+  void operator delete(void *ptr) throw();<br>
+  void operator delete[](void *ptr) throw(int);<br>
+  ~Z() throw(int) {}<br>
+};<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:35: warning: dynamic exception specification 'throw()' is deprecated; consider using 'NOEXCEPT' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:37: warning: dynamic exception specification 'throw(int)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:8: warning: dynamic exception specification 'throw(int)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void operator delete(void *ptr) NOEXCEPT;<br>
+// CHECK-FIXES: void operator delete[](void *ptr) throw(int);<br>
+// CHECK-FIXES: ~Z() throw(int) {}<br>
<br>
Added: clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-opt.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-noexcept-opt.cpp?rev=304977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>test/clang-tidy/modernize-use-<wbr>noexcept-opt.cpp?rev=304977&<wbr>view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-opt.cpp (added)<br>
+++ clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt-opt.cpp Thu Jun  8 09:04:16 2017<br>
@@ -0,0 +1,88 @@<br>
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \<br>
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.UseNoex<wbr>ceptFalse, value: 0}]}" \<br>
+// RUN:   -- -std=c++11<br>
+<br>
+class A {};<br>
+class B {};<br>
+<br>
+void foo() throw();<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void foo() noexcept;<br>
+<br>
+void bar() throw(...);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw(...)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void bar() ;<br>
+<br>
+void k() throw(int(int));<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: dynamic exception specification 'throw(int(int))' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void k() ;<br>
+<br>
+void foobar() throw(A, B)<br>
+{}<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void foobar()<br>
+<br>
+void baz(int = (throw A(), 0)) throw(A, B) {}<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void baz(int = (throw A(), 0)) {}<br>
+<br>
+void g(void (*fp)(void) throw());<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);<br>
+<br>
+void f(void (*fp)(void) throw(int)) throw(char);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'throw(int)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: dynamic exception specification 'throw(char)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void f(void (*fp)(void) ) ;<br>
+<br>
+#define THROW throw<br>
+void h(void (*fp)(void) THROW(int)) THROW(char);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'THROW(int)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: dynamic exception specification 'THROW(char)' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void h(void (*fp)(void) ) ;<br>
+<br>
+void j() throw(int(int) throw(void(void) throw(int)));<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' is deprecated; consider removing it instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void j() ;<br>
+<br>
+class Y {<br>
+  Y() throw() = default;<br>
+};<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: Y() noexcept = default;<br>
+<br>
+struct Z {<br>
+  void operator delete(void *ptr) throw();<br>
+  void operator delete[](void *ptr) throw(int);<br>
+  ~Z() throw(int) {}<br>
+};<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:35: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:37: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:8: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void operator delete(void *ptr) noexcept;<br>
+// CHECK-FIXES: void operator delete[](void *ptr) noexcept(false);<br>
+// CHECK-FIXES: ~Z() noexcept(false) {}<br>
+<br>
+struct S {<br>
+  void f() throw();<br>
+};<br>
+void f(void (S::*)() throw());<br>
+// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:22: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void f() noexcept;<br>
+// CHECK-FIXES: void f(void (S::*)() noexcept);<br>
+<br>
+typedef void (*fp)(void (*fp2)(int) throw());<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: typedef void (*fp)(void (*fp2)(int) noexcept);<br>
+<br>
+// Should not trigger a replacement.<br>
+void titi() noexcept {}<br>
+void toto() noexcept(true) {}<br>
+<br>
+// Should not trigger a replacement.<br>
+void bad()<br>
+#if !__has_feature(cxx_noexcept)<br>
+    throw()<br>
+#endif<br>
+  ;<br>
<br>
Added: clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-noexcept.cpp?rev=304977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>test/clang-tidy/modernize-use-<wbr>noexcept.cpp?rev=304977&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt.cpp (added)<br>
+++ clang-tools-extra/trunk/test/c<wbr>lang-tidy/modernize-use-noexce<wbr>pt.cpp Thu Jun  8 09:04:16 2017<br>
@@ -0,0 +1,104 @@<br>
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \<br>
+// RUN:   -- -std=c++11<br>
+<br>
+class A {};<br>
+class B {};<br>
+<br>
+void foo() throw();<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void foo() noexcept;<br>
+<br>
+template <typename T><br>
+void foo() throw();<br>
+void footest() { foo<int>(); foo<double>(); }<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void foo() noexcept;<br>
+<br>
+void bar() throw(...);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: dynamic exception specification 'throw(...)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void bar() noexcept(false);<br>
+<br>
+void k() throw(int(int));<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: dynamic exception specification 'throw(int(int))' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void k() noexcept(false);<br>
+<br>
+void foobar() throw(A, B)<br>
+{}<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void foobar() noexcept(false)<br>
+<br>
+void baz(int = (throw A(), 0)) throw(A, B) {}<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: dynamic exception specification 'throw(A, B)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {}<br>
+<br>
+void g(void (*fp)(void) throw());<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);<br>
+<br>
+void f(void (*fp)(void) throw(int)) throw(char);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: dynamic exception specification 'throw(char)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void f(void (*fp)(void) noexcept(false)) noexcept(false);<br>
+<br>
+#define THROW throw<br>
+void h(void (*fp)(void) THROW(int)) THROW(char);<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: dynamic exception specification 'THROW(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: dynamic exception specification 'THROW(char)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void h(void (*fp)(void) noexcept(false)) noexcept(false);<br>
+<br>
+void j() throw(int(int) throw(void(void) throw(int)));<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void j() noexcept(false);<br>
+<br>
+class Y {<br>
+  Y() throw() = default;<br>
+};<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: Y() noexcept = default;<br>
+<br>
+struct Z {<br>
+  void operator delete(void *ptr) throw();<br>
+  void operator delete[](void *ptr) throw(int);<br>
+  ~Z() throw(int) {}<br>
+};<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:35: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:37: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:8: warning: dynamic exception specification 'throw(int)' is deprecated; consider using 'noexcept(false)' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void operator delete(void *ptr) noexcept;<br>
+// CHECK-FIXES: void operator delete[](void *ptr) noexcept(false);<br>
+// CHECK-FIXES: ~Z() noexcept(false) {}<br>
+<br>
+struct S {<br>
+  void f() throw();<br>
+};<br>
+void f(void (S::*)() throw());<br>
+// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:22: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void f() noexcept;<br>
+// CHECK-FIXES: void f(void (S::*)() noexcept);<br>
+<br>
+template <typename T><br>
+struct ST {<br>
+  void foo() throw();<br>
+};<br>
+template <typename T><br>
+void ft(void (ST<T>::*)() throw());<br>
+// CHECK-MESSAGES: :[[@LINE-4]]:14: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-MESSAGES: :[[@LINE-2]]:27: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: void foo() noexcept;<br>
+// CHECK-FIXES: void ft(void (ST<T>::*)() noexcept);<br>
+<br>
+typedef void (*fp)(void (*fp2)(int) throw());<br>
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: dynamic exception specification 'throw()' is deprecated; consider using 'noexcept' instead [modernize-use-noexcept]<br>
+// CHECK-FIXES: typedef void (*fp)(void (*fp2)(int) noexcept);<br>
+<br>
+// Should not trigger a replacement.<br>
+void titi() noexcept {}<br>
+void toto() noexcept(true) {}<br>
+<br>
+// Should not trigger a replacement.<br>
+void bad()<br>
+#if !__has_feature(cxx_noexcept)<br>
+    throw()<br>
+#endif<br>
+  ;<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>