================
@@ -270,6 +270,12 @@ llvm::Error Replacements::add(const Replacement &R) {
     assert(R.getLength() == 0);
     // `I` is also an insertion, `R` and `I` conflict.
     if (I->getLength() == 0) {
+      // If the two insertions are identical, `R` is redundant; keep the
+      // existing one rather than concatenating. This happens e.g. when
+      // clang-format analyzes the same code under several preprocessor
+      // branches and emits the same insertion in each run.
+      if (R.getReplacementText() == I->getReplacementText())
----------------
HazardyKnusperkeks wrote:

This fixes the symptom, while the root cause is kept. I'm currently not that 
fit in the preprocessor branches stuff, but it would be nice if we can fix it 
there. It it outside of the branches and an unwrapped line on itself.

https://github.com/llvm/llvm-project/pull/205631
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to