[PATCH] Implemented tab usage only for indentation (http://llvm.org/PR17363)
Manuel Klimek
klimek at google.com
Fri Sep 27 04:46:31 PDT 2013
================
Comment at: lib/Format/WhitespaceManager.cpp:276
@@ -270,1 +275,3 @@
+ case FormatStyle::UT_Never:
Text.append(std::string(Spaces, ' '));
+ break;
----------------
Why's that not IndentLevel * Style.IndentWidth + Spaces?
================
Comment at: lib/Format/WhitespaceManager.cpp:279-287
@@ -272,9 +278,11 @@
+ case FormatStyle::UT_Always: {
unsigned FirstTabWidth =
Style.TabWidth - WhitespaceStartColumn % Style.TabWidth;
// Indent with tabs only when there's at least one full tab.
if (FirstTabWidth + Style.TabWidth <= Spaces) {
Spaces -= FirstTabWidth;
Text.append("\t");
}
Text.append(std::string(Spaces / Style.TabWidth, '\t'));
Text.append(std::string(Spaces % Style.TabWidth, ' '));
+ break;
----------------
Same here...
================
Comment at: lib/Format/WhitespaceManager.cpp:291
@@ +290,3 @@
+ case FormatStyle::UT_ForIndentation:
+ if (WhitespaceStartColumn == 0) {
+ unsigned Indentation = IndentLevel * Style.IndentWidth;
----------------
I'd rather use IndentLevel == 0 to decide that case, but I can see that both are not ideal...
http://llvm-reviews.chandlerc.com/D1770
More information about the cfe-commits
mailing list