This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Prevent a remove only fixit causing a conflict when enclosed by another fixit
Needs ReviewPublic

Authored by njames93 on Jan 22 2020, 8:04 AM.

Details

Summary

Say you have some text 'AAABBBCCCDDD' and there are 2 fix its on that text. Fix-it A just wants to remove all occurances of 'C' and fix-it B wants to replace the entire string with 'XXXXXXXXXXXX'.
These 2 fix its currently get diagnosed as conflicting, and prevent the entire fix it from applying(plus any from the same warning).
However Fix-it A can be disabled (while leaving any other fix its in the same warning active) without causing any conflicts.

Note I haven't included any specific test cases, but running the clang-tools unittests and regression tests yielded no failures.

Diff Detail

Event Timeline

njames93 created this revision.Jan 22 2020, 8:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2020, 8:04 AM
njames93 edited the summary of this revision. (Show Details)Jan 22 2020, 8:10 AM
njames93 added a reviewer: aaron.ballman.
njames93 added a project: Restricted Project.

Unit tests: pass. 62056 tests passed, 0 failed and 783 were skipped.

clang-tidy: unknown.

clang-format: pass.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Eugene.Zelenko added inline comments.
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
733

Please don't use auto unless type is spelled in same statement or iterator.

737

Please don't use auto unless type is spelled in same statement or iterator.

njames93 updated this revision to Diff 239636.Jan 22 2020, 10:01 AM
njames93 marked 3 inline comments as done.
  • remove unnecessary auto
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
733

What if the type is `llvm::SmallDenseSet<const clang::tooling::Replacement *, 4, llvm::DenseMapInfo<const clang::tooling::Replacement *> >`

Unit tests: pass. 62056 tests passed, 0 failed and 783 were skipped.

clang-tidy: unknown.

clang-format: pass.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

njames93 updated this revision to Diff 240163.Jan 24 2020, 5:07 AM
  • Small edge case tweak

Unit tests: fail. 62126 tests passed, 5 failed and 807 were skipped.

failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

We need tests for that. There should be tests for the exporting-feature. Maybe they could provide a good starting point on adding tests. (not sure if there is unit-test code for isolated testing, but some tests do exist!)