diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-07 11:09:06 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-07 11:09:06 +0000 |
commit | 7ad4effaa96905ef9dbc3815760b06b1d1639390 (patch) | |
tree | d658045f8ad4ffcb7d6a2cc8a50f8da9981ddaa1 /lib/Format/Format.cpp | |
parent | 71607512cb70db3c1be8f0287153b681531687fc (diff) |
Add style option for number of spaces before trailing comments.
In LLVM style, a single space should be enough. In Google style, two
spaces are required.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 3dbf95c5a4..5c65c26ca6 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -77,6 +77,7 @@ FormatStyle getLLVMStyle() { LLVMStyle.AccessModifierOffset = -2; LLVMStyle.SplitTemplateClosingGreater = true; LLVMStyle.IndentCaseLabels = false; + LLVMStyle.SpacesBeforeTrailingComments = 1; return LLVMStyle; } @@ -88,6 +89,7 @@ FormatStyle getGoogleStyle() { GoogleStyle.AccessModifierOffset = -1; GoogleStyle.SplitTemplateClosingGreater = false; GoogleStyle.IndentCaseLabels = true; + GoogleStyle.SpacesBeforeTrailingComments = 2; return GoogleStyle; } @@ -299,7 +301,7 @@ private: unsigned Spaces = Annotations[Index].SpaceRequiredBefore ? 1 : 0; if (Annotations[Index].Type == TT_LineComment) - Spaces = 2; + Spaces = Style.SpacesBeforeTrailingComments; if (!DryRun) replaceWhitespace(Current, 0, Spaces); |