[clang-tools-extra] [clang-tidy] Fix warnings caused by "new check" template (PR #80537)

via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 3 02:33:53 PST 2024


Danny =?utf-8?q?Mösch?= <danny.moesch at icloud.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/80537 at github.com>


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy

@llvm/pr-subscribers-clang-tools-extra

Author: Danny Mösch (SimplyDanny)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/80537.diff


1 Files Affected:

- (modified) clang-tools-extra/clang-tidy/add_new_check.py (+1-2) 


``````````diff
diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py
index ada2ee1119cf9..a6af76809af02 100755
--- a/clang-tools-extra/clang-tidy/add_new_check.py
+++ b/clang-tools-extra/clang-tidy/add_new_check.py
@@ -131,7 +131,6 @@ def write_implementation(module_path, module, namespace, check_name_camel):
 //===----------------------------------------------------------------------===//
 
 #include "%(check_name)s.h"
-#include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
 using namespace clang::ast_matchers;
@@ -146,7 +145,7 @@ def write_implementation(module_path, module, namespace, check_name_camel):
 void %(check_name)s::check(const MatchFinder::MatchResult &Result) {
   // FIXME: Add callback implementation.
   const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("x");
-  if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
+  if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().starts_with("awesome_"))
     return;
   diag(MatchedDecl->getLocation(), "function %%0 is insufficiently awesome")
       << MatchedDecl

``````````

</details>


https://github.com/llvm/llvm-project/pull/80537


More information about the cfe-commits mailing list