[clang-tools-extra] 3b919a5 - [clang-tidy] Fix example provided by add_new_check.py
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 30 11:15:39 PDT 2023
Author: Piotr Zegar
Date: 2023-03-30T18:15:29Z
New Revision: 3b919a5e01ef35caa24fe3a4ccc3dd459e56449b
URL: https://github.com/llvm/llvm-project/commit/3b919a5e01ef35caa24fe3a4ccc3dd459e56449b
DIFF: https://github.com/llvm/llvm-project/commit/3b919a5e01ef35caa24fe3a4ccc3dd459e56449b.diff
LOG: [clang-tidy] Fix example provided by add_new_check.py
Currently test for newly added check in clang-tidy fails,
this is because Fix is attached to note, but test is executed
without --fix-notes. This change adding --fix-notes to test.
Fixes: https://github.com/llvm/llvm-project/issues/50400
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D146875
Added:
Modified:
clang-tools-extra/clang-tidy/add_new_check.py
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py
index 8c5e140c47050..98e96553ca8ac 100755
--- a/clang-tools-extra/clang-tidy/add_new_check.py
+++ b/clang-tools-extra/clang-tidy/add_new_check.py
@@ -138,9 +138,9 @@ def write_implementation(module_path, module, namespace, check_name_camel):
if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
return;
diag(MatchedDecl->getLocation(), "function %%0 is insufficiently awesome")
- << MatchedDecl;
- diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note)
+ << MatchedDecl
<< FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
+ diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note);
}
} // namespace clang::tidy::%(namespace)s
@@ -293,7 +293,7 @@ def write_test(module_path, module, check_name, test_extension):
def get_actual_filename(dirname, filename):
- if not os.path.isdir(dirname):
+ if not os.path.isdir(dirname):
return ''
name = os.path.join(dirname, filename)
if (os.path.isfile(name)):
More information about the cfe-commits
mailing list