Page MenuHomePhabricator

[clang-tidy][WIP] Added command line option `fix-notes`
Needs ReviewPublic

Authored by njames93 on Jul 30 2020, 2:22 AM.

Details

Summary

Added an option to control whether to apply the fixes found in notes attached to clang tidy errors or not.
Diagnostics may contain multiple notes each offering different ways to fix the issue, for that reason the default behaviour should be to not look at fixes found in notes.
Instead offer up all the available fix-its in the output but don't try to apply the first one unless -fix-notes is supplied.

Diff Detail

Event Timeline

njames93 created this revision.Jul 30 2020, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 2:22 AM
njames93 requested review of this revision.Jul 30 2020, 2:22 AM
njames93 retitled this revision from [clang-tidy] Added command line option `fix-notes` to [clang-tidy][WIP] Added command line option `fix-notes`.EditedJul 30 2020, 2:22 AM
njames93 added a project: Restricted Project.

This is very much a work in progress
Another direction I was thinking was only apply the fixes found in notes if there is exactly one fix attached to the notes in a diagnostic, instead of just applying the first one we find

Eugene.Zelenko added inline comments.Jul 30 2020, 9:06 AM
clang-tools-extra/clang-tidy/ClangTidy.cpp
109

It'll be reasonable to use member initialization for TotalFixes, AppliedFixes, WarningsAsErrors.

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
252

It'll be reasonable to use member initialization for LastErrorRelatesToUserCode, LastErrorPassesLineFilter, LastErrorWasIgnored.

njames93 marked 2 inline comments as done.Jul 30 2020, 9:30 AM
njames93 added inline comments.
clang-tools-extra/clang-tidy/ClangTidy.cpp
109

It would be, but that's a refactoring change unrelated to this patch

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
252

Ditto