mattbeardsley created this revision. mattbeardsley added reviewers: njames93, aaron.ballman. Herald added a subscriber: xazax.hun. mattbeardsley requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits.
Per this commit, "Note" diagnostics should not be used to provide the default fix behavior: https://reviews.llvm.org/rGabbe9e227ed31e5dde9bb7567bb9f0dd047689c6 With the default clang-tidy behavior being to not "--fix-notes" in the above commit, the add_new_check.py script would generate a check that does not pass its own generated test (before this change) Because the generated example clang-tidy check has a clear default FixItHint, based on the above commit, the FixItHint would be better suited by being sent to the warning diag(...), as opposed to keeping the separate note diag(...) and passing "--fix-notes" in the generated test Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109210 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 @@ -144,8 +144,7 @@ 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_"); }
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 @@ -144,8 +144,7 @@ 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_"); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits