[PATCH] D116314: [clang-format] Add style to separate definition blocks

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 28 13:16:52 PST 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:3054
+  enum SeparateDefinitionStyle {
+    /// Leave definition blocks separated as they are without changing anything
+    SDS_Leave,
----------------
Add full stop at the end of sentences.


================
Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:55
+      auto insertReplacement = [&]() {
+        // Do not handle EOF newlines
+        assert(TargetToken);
----------------
Here also full stop, please. And following comments.


================
Comment at: clang/lib/Format/DefinitionBlockSeparator.h:38-39
+};
+} // end namespace format
+} // end namespace clang
+
----------------
I know you copied it. It is wrong where you copied it from. :)


================
Comment at: clang/lib/Format/Format.cpp:2114
+      if (Result.add(R))
+        return;
+  }
----------------
ksyx wrote:
> HazardyKnusperkeks wrote:
> > Why only add the first replacement?
> This worked well as the `Error` class `add` method returned has overloaded boolean operator, returning true (nonzero) when failing, which simulates program exit code scheme? (ref: [[ https://llvm.org/doxygen/classllvm_1_1Error.html#a981b4992a3b7cce718c7995a7d6193a0 | Doxygen/Error/operator bool ]])
Okay, but maybe safe the result in `Error` to make it clearer.


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

https://reviews.llvm.org/D116314



More information about the cfe-commits mailing list