This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rG3b919a5e01ef: [clang-tidy] Fix example provided by add_new_check.py (authored by PiotrZSL).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146875/new/ https://reviews.llvm.org/D146875 Files: clang-tools-extra/clang-tidy/add_new_check.py Index: clang-tools-extra/clang-tidy/add_new_check.py =================================================================== --- clang-tools-extra/clang-tidy/add_new_check.py +++ clang-tools-extra/clang-tidy/add_new_check.py @@ -138,9 +138,9 @@ 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 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)):
Index: clang-tools-extra/clang-tidy/add_new_check.py =================================================================== --- clang-tools-extra/clang-tidy/add_new_check.py +++ clang-tools-extra/clang-tidy/add_new_check.py @@ -138,9 +138,9 @@ 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 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)):
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits