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.
llvm-svn: 171725
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 3dbf95c..5c65c26 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -77,6 +77,7 @@
LLVMStyle.AccessModifierOffset = -2;
LLVMStyle.SplitTemplateClosingGreater = true;
LLVMStyle.IndentCaseLabels = false;
+ LLVMStyle.SpacesBeforeTrailingComments = 1;
return LLVMStyle;
}
@@ -88,6 +89,7 @@
GoogleStyle.AccessModifierOffset = -1;
GoogleStyle.SplitTemplateClosingGreater = false;
GoogleStyle.IndentCaseLabels = true;
+ GoogleStyle.SpacesBeforeTrailingComments = 2;
return GoogleStyle;
}
@@ -299,7 +301,7 @@
unsigned Spaces = Annotations[Index].SpaceRequiredBefore ? 1 : 0;
if (Annotations[Index].Type == TT_LineComment)
- Spaces = 2;
+ Spaces = Style.SpacesBeforeTrailingComments;
if (!DryRun)
replaceWhitespace(Current, 0, Spaces);