summaryrefslogtreecommitdiff
path: root/lib/Format/ContinuationIndenter.h
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-10-14 00:46:35 +0000
committerAlexander Kornienko <alexfh@google.com>2013-10-14 00:46:35 +0000
commitf0fc89c358cdd0717c0e12eb4a90e4a6ce956e98 (patch)
treec64ebcbfca145234391887686b7d082467ee578f /lib/Format/ContinuationIndenter.h
parent8bfc1e118169229960b90a4ef8761ee0eb296755 (diff)
downloadclang-f0fc89c358cdd0717c0e12eb4a90e4a6ce956e98.tar.gz
Keep track of indentation levels in static initializers for correct indentation with tabs.
Summary: Store IndentationLevel in ParentState and use it instead of the Line::Level when indening. Also fixed incorrect indentation level calculation in formatFirstToken. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192563 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/ContinuationIndenter.h')
-rw-r--r--lib/Format/ContinuationIndenter.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Format/ContinuationIndenter.h b/lib/Format/ContinuationIndenter.h
index 60e0027ec7..b317565833 100644
--- a/lib/Format/ContinuationIndenter.h
+++ b/lib/Format/ContinuationIndenter.h
@@ -125,10 +125,10 @@ private:
};
struct ParenState {
- ParenState(unsigned Indent, unsigned LastSpace, bool AvoidBinPacking,
- bool NoLineBreak)
- : Indent(Indent), LastSpace(LastSpace), FirstLessLess(0),
- BreakBeforeClosingBrace(false), QuestionColumn(0),
+ ParenState(unsigned Indent, unsigned IndentLevel, unsigned LastSpace,
+ bool AvoidBinPacking, bool NoLineBreak)
+ : Indent(Indent), IndentLevel(IndentLevel), LastSpace(LastSpace),
+ FirstLessLess(0), BreakBeforeClosingBrace(false), QuestionColumn(0),
AvoidBinPacking(AvoidBinPacking), BreakBeforeParameter(false),
NoLineBreak(NoLineBreak), ColonPos(0), StartOfFunctionCall(0),
StartOfArraySubscripts(0), NestedNameSpecifierContinuation(0),
@@ -139,6 +139,9 @@ struct ParenState {
/// indented.
unsigned Indent;
+ /// \brief The number of indentation levels of the block.
+ unsigned IndentLevel;
+
/// \brief The position of the last space on each level.
///
/// Used e.g. to break like: