Add a field indicating the associated check for every replacement to the YAML report generated with the '-export-fixes' option.
Update clang-apply-replacements to handle the new format.
Follow-up to D16183
Paths
| Differential D26137
[clang-tidy] Add check name to YAML export ClosedPublic Authored by Alpha on Oct 31 2016, 3:15 AM.
Details
Summary Add a field indicating the associated check for every replacement to the YAML report generated with the '-export-fixes' option. Follow-up to D16183
Diff Detail
Event TimelineAlpha updated this object. alexfh edited edge metadata. Comment ActionsThank you for resurrecting this patch! A few comments inline.
This revision now requires changes to proceed.Nov 7 2016, 11:52 AM
Alpha edited edge metadata. Comment ActionsExport effectively MainSourceFile. Comment Actions What happens to diagnostics without fixes? e.g. from the readability-function-size check. Comment Actions This shouldn't affect diagnostics without fixes. If there is no fix, there won't be anything to export, and the diagnostic just behaves normally. Comment Actions
That's a shame; I need a machine readable report of all diagnostics. Comment Actions
This is not the aim of this change-set. The objective here is only to associate a replacement to the diagnostic from which it was emitted. But having a parse-able output for all clang-tidy's diagnostics can indeed be a nice feature to add in a different patch. alexfh edited edge metadata. Comment ActionsLooks mostly good. A few more nits.
This revision now requires changes to proceed.Nov 30 2016, 8:34 AM Alpha added inline comments.
alexfh edited edge metadata. Comment ActionsLG with a comment.
This revision is now accepted and ready to land.Dec 1 2016, 5:53 AM Comment Actions Do you have commit access? If you need me to commit the patch for you, please rebase it on top of HEAD. Comment Actions The patch spans two repos, so I couldn't apply it using arcanist. Just made it "manually" (patch -p0 -i ...); now running tests... alexfh edited edge metadata. Comment ActionsLooks like compiler has found a couple of bugs: In file included from llvm.git/tools/clang/tools/extra/clang-tidy/ClangTidy.cpp:38: llvm.git/tools/clang/include/clang/Tooling/DiagnosticsYaml.h:38:53: error: field 'Message' is uninitialized when used here [-Werror,-Wuninitialized] : DiagnosticName(D.DiagnosticName), Message(Message), Fix(D.Fix), ^ llvm.git/tools/clang/include/clang/Tooling/DiagnosticsYaml.h:70:7: error: ignoring return value of function declared with warn_unused_result attribute [-Werror,-Wunused-result] Keys->Fix[Fix.getFilePath()].add(Fix); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ 2 errors generated. Please fix. This revision now requires changes to proceed.Dec 8 2016, 8:20 AM Alpha edited edge metadata. Comment ActionsFix clang compilation warnings. These didn't appear when compiled on Windows. Comment Actions Have you run the tests? I see a number of failures: $ ninja check-clang-tools ... Failing Tests (6): Clang Tools :: clang-apply-replacements/basic.cpp Clang Tools :: clang-apply-replacements/conflict.cpp Clang Tools :: clang-apply-replacements/crlf.cpp Clang Tools :: clang-apply-replacements/format.cpp Clang Tools :: clang-rename/ClassReplacements.cpp Clang Tools :: clang-tidy/clang-tidy-run-with-database.cpp Expected Passes : 488 Expected Failures : 1 Unexpected Failures: 6 This revision now requires changes to proceed.Dec 13 2016, 6:54 AM Alpha edited edge metadata. Comment ActionsIt was tested against the clang extra unit tests, but not tests run with check-clang-tools. Comment Actions Err, looks like I forgot to post comments I entered a few days ago. Just a few nits.
This revision is now accepted and ready to land.Jan 3 2017, 6:42 AM Closed by commit rL290892: [clang-tidy] Add check name to YAML export (authored by alexfh). · Explain WhyJan 3 2017, 6:46 AM This revision was automatically updated to reflect the committed changes. Comment Actions Thanks for the review!
Revision Contents
Diff 80732 include/clang/Tooling/Core/Diagnostic.h
include/clang/Tooling/Core/Replacement.h
include/clang/Tooling/DiagnosticsYaml.hinclude/clang/Tooling/ReplacementsYaml.h
lib/Tooling/Core/CMakeLists.txt
lib/Tooling/Core/Diagnostic.cpp
tools/extra/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h
tools/extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
tools/extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
tools/extra/clang-tidy/ClangTidy.h
tools/extra/clang-tidy/ClangTidy.cpp
tools/extra/clang-tidy/ClangTidyDiagnosticConsumer.h
tools/extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
tools/extra/clang-tidy/tool/ClangTidyMain.cpp
unittests/Tooling/ReplacementsYamlTest.cpp
|
What are the constraints on the location? Should it be a file location or macro locations are fine too? Please add a (doxygen-style) comment.