[PATCH] D68682: format::cleanupAroundReplacements removes whole line when Removals leave previously non-blank line blank

Conrad Poelman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 22 20:32:41 PST 2019


poelmanc updated this revision to Diff 235090.
poelmanc marked 2 inline comments as done.
poelmanc added a comment.

Fix algorithm to fix failing `ToolingTests/ApplyAtomicChangesTest.FormatsCorrectLineWhenHeaderIsRemoved`. That test revealed a very specific but real failure case: if existing Removals removed all whitespace **including** the line's ending newline, **and** the subsequent line contained only a newline, it would delete the subsequent newline too, which was not desired. Added a new test `CleanUpReplacementsTest.RemoveLineAndNewlineLineButNotNext` to explicitly test this case.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68682/new/

https://reviews.llvm.org/D68682

Files:
  clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-redundant-void-arg.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-redundant-control-flow.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-redundant-declaration.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-redundant-member-init.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp
  clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp
  clang/include/clang/Basic/CharInfo.h
  clang/include/clang/Format/Format.h
  clang/lib/AST/CommentLexer.cpp
  clang/lib/AST/CommentParser.cpp
  clang/lib/Format/Format.cpp
  clang/unittests/Format/CleanupTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68682.235090.patch
Type: text/x-patch
Size: 43973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191223/16806bb4/attachment-0001.bin>


More information about the cfe-commits mailing list