diff options
author | Daniel Jasper <djasper@google.com> | 2013-03-01 16:48:32 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-03-01 16:48:32 +0000 |
commit | f9a84b5f577dda8468f471ba2e2e5791f9962ce1 (patch) | |
tree | 0535565c4ffdc78eda5008758722ca180a48011a /clang/lib/Format/TokenAnnotator.h | |
parent | 3324cbefcde82930503483819cf76077192840d2 (diff) | |
download | bcm5719-llvm-f9a84b5f577dda8468f471ba2e2e5791f9962ce1.tar.gz bcm5719-llvm-f9a84b5f577dda8468f471ba2e2e5791f9962ce1.zip |
Normal indent for last element of builder-type call.
In builder type call, we indent to the laster function calls.
However, for the last element of such a call, we don't need to do
so, as that normally just wastes space and does not increase
readability.
Before:
aaaaaa->aaaaaa->aaaaaa( // break
aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa
->aaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
aaaaaa->aaaaaa->aaaaaa( // break
aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 176352
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.h')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h index aa78779f9b0..b79ee97da82 100644 --- a/clang/lib/Format/TokenAnnotator.h +++ b/clang/lib/Format/TokenAnnotator.h @@ -75,7 +75,7 @@ public: ClosesTemplateDeclaration(false), MatchingParen(NULL), ParameterCount(0), BindingStrength(0), SplitPenalty(0), LongestObjCSelectorName(0), Parent(NULL), FakeLParens(0), - FakeRParens(0) { + FakeRParens(0), LastInChainOfCalls(false) { } bool is(tok::TokenKind Kind) const { return FormatTok.Tok.is(Kind); } @@ -127,6 +127,9 @@ public: /// \brief Insert this many fake ) after this token for correct indentation. unsigned FakeRParens; + /// \brief Is this the last "." or "->" in a builder-type call? + bool LastInChainOfCalls; + const AnnotatedToken *getPreviousNoneComment() const { AnnotatedToken *Tok = Parent; while (Tok != NULL && Tok->is(tok::comment)) |