diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-09-27 16:14:22 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-09-27 16:14:22 +0000 |
commit | 3c3d09c8858094260485f4e9bce7936da66458b4 (patch) | |
tree | 336de1eb7184a5b9f3a99adee7aa6f9dfac59ff7 /clang/lib/Format/BreakableToken.h | |
parent | ca9bd8fac15cff2cceba47d97a114cd6db7b44e3 (diff) | |
download | bcm5719-llvm-3c3d09c8858094260485f4e9bce7936da66458b4.tar.gz bcm5719-llvm-3c3d09c8858094260485f4e9bce7936da66458b4.zip |
Implemented tab usage only for indentation (http://llvm.org/PR17363)
Summary:
Changed UseTab to be a enum with three options: Never, Always,
ForIndentation (true/false are still supported when reading .clang-format).
IndentLevel should currently be propagated correctly for all tokens, except for
block comments. Please take a look at the general idea before I start dealing
with block comments.
Reviewers: klimek, djasper
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1770
llvm-svn: 191527
Diffstat (limited to 'clang/lib/Format/BreakableToken.h')
-rw-r--r-- | clang/lib/Format/BreakableToken.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h index af3b09b5a52..132301c9f60 100644 --- a/clang/lib/Format/BreakableToken.h +++ b/clang/lib/Format/BreakableToken.h @@ -66,12 +66,14 @@ public: WhitespaceManager &Whitespaces) {} protected: - BreakableToken(const FormatToken &Tok, bool InPPDirective, - encoding::Encoding Encoding, const FormatStyle &Style) - : Tok(Tok), InPPDirective(InPPDirective), Encoding(Encoding), - Style(Style) {} + BreakableToken(const FormatToken &Tok, unsigned IndentLevel, + bool InPPDirective, encoding::Encoding Encoding, + const FormatStyle &Style) + : Tok(Tok), IndentLevel(IndentLevel), InPPDirective(InPPDirective), + Encoding(Encoding), Style(Style) {} const FormatToken &Tok; + const unsigned IndentLevel; const bool InPPDirective; const encoding::Encoding Encoding; const FormatStyle &Style; @@ -88,9 +90,10 @@ public: StringRef::size_type Length) const; protected: - BreakableSingleLineToken(const FormatToken &Tok, unsigned StartColumn, - StringRef Prefix, StringRef Postfix, - bool InPPDirective, encoding::Encoding Encoding, + BreakableSingleLineToken(const FormatToken &Tok, unsigned IndentLevel, + unsigned StartColumn, StringRef Prefix, + StringRef Postfix, bool InPPDirective, + encoding::Encoding Encoding, const FormatStyle &Style); // The column in which the token starts. @@ -109,10 +112,10 @@ public: /// /// \p StartColumn specifies the column in which the token will start /// after formatting. - BreakableStringLiteral(const FormatToken &Tok, unsigned StartColumn, - StringRef Prefix, StringRef Postfix, - bool InPPDirective, encoding::Encoding Encoding, - const FormatStyle &Style); + BreakableStringLiteral(const FormatToken &Tok, unsigned IndentLevel, + unsigned StartColumn, StringRef Prefix, + StringRef Postfix, bool InPPDirective, + encoding::Encoding Encoding, const FormatStyle &Style); virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit) const; @@ -126,9 +129,9 @@ public: /// /// \p StartColumn specifies the column in which the comment will start /// after formatting. - BreakableLineComment(const FormatToken &Token, unsigned StartColumn, - bool InPPDirective, encoding::Encoding Encoding, - const FormatStyle &Style); + BreakableLineComment(const FormatToken &Token, unsigned IndentLevel, + unsigned StartColumn, bool InPPDirective, + encoding::Encoding Encoding, const FormatStyle &Style); virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit) const; @@ -150,10 +153,10 @@ public: /// after formatting, while \p OriginalStartColumn specifies in which /// column the comment started before formatting. /// If the comment starts a line after formatting, set \p FirstInLine to true. - BreakableBlockComment(const FormatToken &Token, unsigned StartColumn, - unsigned OriginaStartColumn, bool FirstInLine, - bool InPPDirective, encoding::Encoding Encoding, - const FormatStyle &Style); + BreakableBlockComment(const FormatToken &Token, unsigned IndentLevel, + unsigned StartColumn, unsigned OriginaStartColumn, + bool FirstInLine, bool InPPDirective, + encoding::Encoding Encoding, const FormatStyle &Style); virtual unsigned getLineCount() const; virtual unsigned getLineLengthAfterSplit(unsigned LineIndex, |