[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 21:00:13 PST 2019
poelmanc marked an inline comment as done.
poelmanc added inline comments.
================
Comment at: clang/include/clang/Basic/CharInfo.h:94
+LLVM_READONLY inline bool isWhitespace(llvm::StringRef S) {
+ for (StringRef::const_iterator I = S.begin(), E = S.end(); I != E; ++I) {
+ if (!isWhitespace(*I))
----------------
alexfh wrote:
> I'd suggest to avoid overloading here. A name like `isWhitespaceOnly` would be less ambiguous.
>
> As for implementation, it can be less verbose:
> ```
> for (char C : S)
> if (!isWhitespace(*I))
> return false;
> return true;
> ```
> or just
> ```
> return llvm::all_of(S, isWhitespace);
> ```
Thanks for the suggestion, I've removed the overloading and updated the implementation.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68682/new/
https://reviews.llvm.org/D68682
More information about the cfe-commits
mailing list