[clang-tools-extra] r356792 - [clang-tidy] anyOf(hasName(..), hasName(..)) -> hasAnyName

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 11:37:45 PDT 2019


Author: alexfh
Date: Fri Mar 22 11:37:45 2019
New Revision: 356792

URL: http://llvm.org/viewvc/llvm-project?rev=356792&view=rev
Log:
[clang-tidy] anyOf(hasName(..), hasName(..)) -> hasAnyName

+ a minor style fix

Modified:
    clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp
    clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h

Modified: clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp?rev=356792&r1=356791&r2=356792&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp Fri Mar 22 11:37:45 2019
@@ -19,10 +19,10 @@ namespace clang {
 namespace tidy {
 namespace cert {
 
-const char SetLongJmpCheck::DiagWording[] =
+namespace {
+const char DiagWording[] =
     "do not call %0; consider using exception handling instead";
 
-namespace {
 class SetJmpMacroCallbacks : public PPCallbacks {
   SetLongJmpCheck &Check;
 
@@ -36,7 +36,7 @@ public:
       return;
 
     if (II->getName() == "setjmp")
-      Check.diag(Range.getBegin(), Check.DiagWording) << II;
+      Check.diag(Range.getBegin(), DiagWording) << II;
   }
 };
 } // namespace
@@ -62,10 +62,10 @@ void SetLongJmpCheck::registerMatchers(M
   // In case there is an implementation that happens to define setjmp as a
   // function instead of a macro, this will also catch use of it. However, we
   // are primarily searching for uses of longjmp.
-  Finder->addMatcher(callExpr(callee(functionDecl(anyOf(hasName("setjmp"),
-                                                        hasName("longjmp")))))
-                         .bind("expr"),
-                     this);
+  Finder->addMatcher(
+      callExpr(callee(functionDecl(hasAnyName("setjmp", "longjmp"))))
+          .bind("expr"),
+      this);
 }
 
 void SetLongJmpCheck::check(const MatchFinder::MatchResult &Result) {

Modified: clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h?rev=356792&r1=356791&r2=356792&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h Fri Mar 22 11:37:45 2019
@@ -26,8 +26,6 @@ public:
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
   void registerPPCallbacks(CompilerInstance &Compiler) override;
-
-  static const char DiagWording[];
 };
 
 } // namespace cert




More information about the cfe-commits mailing list