diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-11 12:36:37 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-11 12:36:37 +0000 |
commit | eef30490fd13fe4f460df5a18695215ddef2ace1 (patch) | |
tree | e593d1a058faa118d9f0b37fa80243aea6e12b25 /clang/lib/Format/Format.cpp | |
parent | 0c13795f68a3d2fe0bc31650260809ad8f160a3b (diff) | |
download | bcm5719-llvm-eef30490fd13fe4f460df5a18695215ddef2ace1.tar.gz bcm5719-llvm-eef30490fd13fe4f460df5a18695215ddef2ace1.zip |
Fix invalid formatting with spaces before trailing comments.
In google style, trailing comments are separated by two spaces. This
patch fixes the counting of these spaces and prevents clang-format from
creating a line with 81 columns.
llvm-svn: 174879
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index a78b650dfad..ab71d593599 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -489,9 +489,7 @@ private: (RootToken.is(tok::kw_for) || State.ParenLevel == 0)) State.VariablePos = State.Column - Previous.FormatTok.TokenLength; - unsigned Spaces = State.NextToken->SpaceRequiredBefore ? 1 : 0; - if (State.NextToken->Type == TT_LineComment) - Spaces = Style.SpacesBeforeTrailingComments; + unsigned Spaces = State.NextToken->SpacesRequiredBefore; if (!DryRun) Whitespaces.replaceWhitespace(Current, 0, Spaces, State.Column, Style); @@ -1099,7 +1097,7 @@ private: AnnotatedToken *Tok = &(I + 1)->First; if (Tok->Children.empty() && Tok->is(tok::r_brace) && !Tok->MustBreakBefore && Tok->TotalLength <= Limit) { - Tok->SpaceRequiredBefore = false; + Tok->SpacesRequiredBefore = 0; join(Line, *(I + 1)); I += 1; } else { |