Skip to content

[clang-tidy] Fix warnings caused by "new check" template #80537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 3, 2024

Conversation

SimplyDanny
Copy link
Member

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Feb 3, 2024

@llvm/pr-subscribers-clang-tidy

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

Author: Danny Mösch (SimplyDanny)

Changes

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 --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

@SimplyDanny SimplyDanny merged commit 514d069 into llvm:main Feb 3, 2024
@SimplyDanny SimplyDanny deleted the template-warnings branch February 3, 2024 12:49
agozillon pushed a commit to agozillon/llvm-project that referenced this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants