diff options
author | Daniel Jasper <djasper@google.com> | 2015-05-11 15:15:48 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-05-11 15:15:48 +0000 |
commit | 015c7a91f12fba37d0ae656931857a1f00cb6b48 (patch) | |
tree | dc54bceb4b69678dd7a45c070c437a980e66ecad /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 104a383e120657d7a384a301ddda9067a8afbf0e (diff) | |
download | bcm5719-llvm-015c7a91f12fba37d0ae656931857a1f00cb6b48.tar.gz bcm5719-llvm-015c7a91f12fba37d0ae656931857a1f00cb6b48.zip |
clang-format: Support aligning ObjC string literals.
Before:
NSString s = @"aaaa"
@"bbbb";
After:
NSString s = @"aaaa"
@"bbbb";
llvm-svn: 237000
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 1c262c2be92..54b8c510d74 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -542,7 +542,9 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { if (Current.is(tok::identifier) && Current.Next && Current.Next->is(TT_DictLiteral)) return State.Stack.back().Indent; - if (NextNonComment->isStringLiteral() && State.StartOfStringLiteral != 0) + if ((NextNonComment->isStringLiteral() || + NextNonComment->is(TT_ObjCStringLiteral)) && + State.StartOfStringLiteral != 0) return State.StartOfStringLiteral; if (NextNonComment->is(tok::lessless) && State.Stack.back().FirstLessLess != 0) @@ -690,7 +692,8 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State, moveStatePastScopeCloser(State); moveStatePastFakeRParens(State); - if (Current.isStringLiteral() && State.StartOfStringLiteral == 0) { + if ((Current.isStringLiteral() || Current.is(TT_ObjCStringLiteral)) && + State.StartOfStringLiteral == 0) { State.StartOfStringLiteral = State.Column; } else if (!Current.isOneOf(tok::comment, tok::identifier, tok::hash) && !Current.isStringLiteral()) { |