[clang-tools-extra] r254517 - Replace the custom AST matcher for nothrow functions with the canonical AST matcher from r254516.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 07:24:47 PST 2015


Author: aaronballman
Date: Wed Dec  2 09:24:47 2015
New Revision: 254517

URL: http://llvm.org/viewvc/llvm-project?rev=254517&view=rev
Log:
Replace the custom AST matcher for nothrow functions with the canonical AST matcher from r254516.

Modified:
    clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp
    clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
    clang-tools-extra/trunk/clang-tidy/utils/Matchers.h

Modified: clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp?rev=254517&r1=254516&r2=254517&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp Wed Dec  2 09:24:47 2015
@@ -26,7 +26,7 @@ void StaticObjectExceptionCheck::registe
   Finder->addMatcher(
       varDecl(anyOf(hasThreadStorageDuration(), hasStaticStorageDuration()),
               hasInitializer(cxxConstructExpr(hasDeclaration(
-                  cxxConstructorDecl(unless(matchers::isNoThrow()))
+                  cxxConstructorDecl(unless(isNoThrow()))
                       .bind("ctor")))))
           .bind("var"),
       this);

Modified: clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp?rev=254517&r1=254516&r2=254517&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp Wed Dec  2 09:24:47 2015
@@ -23,7 +23,7 @@ void ThrownExceptionTypeCheck::registerM
   Finder->addMatcher(
       cxxThrowExpr(
           has(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
-              isCopyConstructor(), unless(matchers::isNoThrow()))))
+              isCopyConstructor(), unless(isNoThrow()))))
           .bind("expr"))),
       this);
 }

Modified: clang-tools-extra/trunk/clang-tidy/utils/Matchers.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/Matchers.h?rev=254517&r1=254516&r2=254517&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/Matchers.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/Matchers.h Wed Dec  2 09:24:47 2015
@@ -23,22 +23,6 @@ AST_MATCHER(QualType, isExpensiveToCopy)
   return IsExpensive && *IsExpensive;
 }
 
-AST_MATCHER(FunctionDecl, isNoThrow) {
-  const auto *FnTy = Node.getType()->getAs<FunctionProtoType>();
-  
-  // If the function does not have a prototype, then it is assumed to be a
-  // throwing function (as it would if the function did not have any exception
-  // specification).
-  if (!FnTy)
-    return false;
-
-  // Assume the best for any unresolved exception specification.
-  if (isUnresolvedExceptionSpec(FnTy->getExceptionSpecType()))
-    return true;
-
-  return FnTy->isNothrow(Node.getASTContext());
-}
-
 } // namespace matchers
 } // namespace tidy
 } // namespace clang




More information about the cfe-commits mailing list