[PATCH] Implemented tab usage only for indentation (http://llvm.org/PR17363)

Alexander Kornienko alexfh at google.com
Fri Sep 27 07:23:12 PDT 2013



================
Comment at: lib/Format/WhitespaceManager.cpp:276
@@ -270,1 +275,3 @@
+  case FormatStyle::UT_Never:
     Text.append(std::string(Spaces, ' '));
+    break;
----------------
Manuel Klimek wrote:
> Why's that not IndentLevel * Style.IndentWidth + Spaces?
It seems easier to track IndentLevel completely independently of Spaces, and just have to deal with it here.

================
Comment at: lib/Format/WhitespaceManager.cpp:291
@@ +290,3 @@
+  case FormatStyle::UT_ForIndentation:
+    if (WhitespaceStartColumn == 0) {
+      unsigned Indentation = IndentLevel * Style.IndentWidth;
----------------
Manuel Klimek wrote:
> I'd rather use IndentLevel == 0 to decide that case, but I can see that both are not ideal...
I think, this is a more appropriate check that we're at the start of line. Otherwise, we'd have to set IndentLevel to 0 when we break the line, and this would have to be done in more than one place.


http://llvm-reviews.chandlerc.com/D1770



More information about the cfe-commits mailing list