Open mikaelholmen opened 6 years ago
Problem seem to originate from that we have found two different replacements.
I don't see a need for the assert unless we have actually used the -fix or -fix-error flag. Then you can at least get the diagnostics.
Maybe it's possible to save both solutions and try to resolve the conflict when they are actually applied, and if it can't be resolved, just leave the code untouched. But this is probably a more complex change.
Extended Description
clang-tidy foo.c --
on foo.c only containing
a = a && 3;
gives a failed assertion:
Fix conflicts with existing fix! The new replacement overlaps with an existing replacement. New replacement: /data/repo/llvm-dev2/foo.c: 5:+5:"" Existing replacement: /data/repo/llvm-dev2/foo.c: 6:+2:"&" clang-tidy: ../tools/clang/tools/extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:86: virtual void (anonymous namespace)::ClangTidyDiagnosticRenderer::emitCodeContext(clang::FullSourceLoc, DiagnosticsEngine::Level, SmallVectorImpl &, ArrayRef): Assertion `false && "Fix conflicts with existing fix!"' failed.
Abort
Changing the input to:
a = a && 1;
avoids the crash and instead we get a bunch of (seemingly correct) warnings.
The crash started appearing with clang-tools-extra commit r284399 2016-10-17: