[PATCH] Refactor clang-format's formatter.

Manuel Klimek klimek at google.com
Tue May 12 02:27:25 PDT 2015


================
Comment at: lib/Format/UnwrappedLineFormatter.cpp:30
@@ +29,3 @@
+///
+/// When \c updateIndentForLine is called for each \c AnnotatedLine, \c
+/// getIndent() will return the indent for the last line \c updateIndentForLine
----------------
djasper wrote:
> This should be stronger, i.e. updateIndentForLine must be called...
Done.

================
Comment at: lib/Format/UnwrappedLineFormatter.cpp:34
@@ +33,3 @@
+/// If the line is not formatted (and thus the indent does not change), calling
+/// \c updateLevelIndentFromUnmodifiedLine will cause subsequent lines on the
+/// same level to be indented at the same level as the given line.
----------------
djasper wrote:
> This should somehow include that updateLevelIndentFromUnmodifiedLine needs to be called *in addition* to updateIndentForLine.
Done.

================
Comment at: lib/Format/UnwrappedLineFormatter.cpp:51
@@ +50,3 @@
+  /// next.
+  void updateIndentForLine(const AnnotatedLine &Line) {
+    Offset = getIndentOffset(*Line.First);
----------------
djasper wrote:
> I'd probably just call this nextLine.
Done.

================
Comment at: lib/Format/UnwrappedLineFormatter.cpp:71
@@ +70,3 @@
+  /// method.
+  void updateLevelIndentFromUnmodifiedLine(const AnnotatedLine &Line) {
+    unsigned LevelIndent = Line.First->OriginalColumn;
----------------
djasper wrote:
> maybe adjustToUnmodifiedLine
Done.

http://reviews.llvm.org/D9662

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list