[clang-tidy] Fix example provided by add_new_check.py
authorPiotr Zegar <me@piotrzegar.pl>
Thu, 30 Mar 2023 18:14:42 +0000 (18:14 +0000)
committerPiotr Zegar <me@piotrzegar.pl>
Thu, 30 Mar 2023 18:15:29 +0000 (18:15 +0000)
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

clang-tools-extra/clang-tidy/add_new_check.py

index 8c5e140..98e9655 100755 (executable)
@@ -138,9 +138,9 @@ void %(check_name)s::check(const MatchFinder::MatchResult &Result) {
   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 @@ void awesome_f2();
 
 
 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)):