aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/BreakableToken.h
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-09-27 16:14:22 +0000
committerAlexander Kornienko <alexfh@google.com>2013-09-27 16:14:22 +0000
commit3d9ffcf3aa0ed84fa297e3c461bb84e48221aa2d (patch)
tree25eb08f63c440b4bf017af1fdfb0db8890057af6 /lib/Format/BreakableToken.h
parenta53d7a0259ff88f78ba8ecac7d0cb3ea96302b1d (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/BreakableToken.h')
-rw-r--r--lib/Format/BreakableToken.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/lib/Format/BreakableToken.h b/lib/Format/BreakableToken.h
index af3b09b5a5..132301c9f6 100644
--- a/lib/Format/BreakableToken.h
+++ b/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,