diff options
| author | Daniel Jasper <djasper@google.com> | 2014-05-06 14:12:21 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-05-06 14:12:21 +0000 |
| commit | 166c19bd373ca6fcdce897a6a540c610434c7171 (patch) | |
| tree | 53e75cb2f353e00ed10376840e508bae8d70b51a /clang/lib/Format/TokenAnnotator.cpp | |
| parent | aa44aaee90dda304dab4024f9cc8fd7489dfcbea (diff) | |
| download | bcm5719-llvm-166c19bd373ca6fcdce897a6a540c610434c7171.tar.gz bcm5719-llvm-166c19bd373ca6fcdce897a6a540c610434c7171.zip | |
clang-format: [JS] Keep space between 'return' and '['.
llvm-svn: 208090
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 98ef453e4cd..e873e984605 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1215,7 +1215,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) { } } } else if (Current->SpacesRequiredBefore == 0 && - spaceRequiredBefore(Line, *Current)) { + spaceRequiredBefore(Line, *Current)) { Current->SpacesRequiredBefore = 1; } @@ -1385,6 +1385,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, (Left.TokenText == "returns" || Left.TokenText == "option")) return true; } + if (Left.is(tok::kw_return) && Right.isNot(tok::semi)) + return true; if (Style.ObjCSpaceAfterProperty && Line.Type == LT_ObjCProperty && Left.Tok.getObjCKeywordID() == tok::objc_property) return true; @@ -1459,8 +1461,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, if (Left.is(tok::r_paren) && Left.Type == TT_AttributeParen) return true; return Line.Type == LT_ObjCDecl || - Left.isOneOf(tok::kw_return, tok::kw_new, tok::kw_delete, - tok::semi) || + Left.isOneOf(tok::kw_new, tok::kw_delete, tok::semi) || (Style.SpaceBeforeParens != FormatStyle::SBPO_Never && (Left.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, tok::kw_switch, tok::kw_catch, tok::kw_case) || |

