summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-05-06 14:11:27 +0000
committerAlexander Kornienko <alexfh@google.com>2013-05-06 14:11:27 +0000
commitc860266e0fc8442c4d3d4015f4ef17da7db8cfed (patch)
tree21aa3094e83f0dc95c36d08437318dc87e8f1435 /clang/lib/Format/Format.cpp
parent57dc142d40e2c2d1af0a0676d79e3e31e59270ad (diff)
downloadbcm5719-llvm-c860266e0fc8442c4d3d4015f4ef17da7db8cfed.tar.gz
bcm5719-llvm-c860266e0fc8442c4d3d4015f4ef17da7db8cfed.zip
Added Mozilla style, cleaned get*Style methods.
Summary: Patch based on a patch by Ehsan Akhgari. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D750 llvm-svn: 181196
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp52
1 files changed, 32 insertions, 20 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 68626d29ca0..a0557f78182 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -36,43 +36,43 @@ namespace format {
FormatStyle getLLVMStyle() {
FormatStyle LLVMStyle;
- LLVMStyle.ColumnLimit = 80;
- LLVMStyle.MaxEmptyLinesToKeep = 1;
- LLVMStyle.PointerBindsToType = false;
- LLVMStyle.DerivePointerBinding = false;
LLVMStyle.AccessModifierOffset = -2;
- LLVMStyle.Standard = FormatStyle::LS_Cpp03;
- LLVMStyle.IndentCaseLabels = false;
- LLVMStyle.SpacesBeforeTrailingComments = 1;
- LLVMStyle.BinPackParameters = true;
+ LLVMStyle.AlignEscapedNewlinesLeft = false;
LLVMStyle.AllowAllParametersOfDeclarationOnNextLine = true;
- LLVMStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = false;
LLVMStyle.AllowShortIfStatementsOnASingleLine = false;
+ LLVMStyle.BinPackParameters = true;
+ LLVMStyle.ColumnLimit = 80;
+ LLVMStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = false;
+ LLVMStyle.DerivePointerBinding = false;
+ LLVMStyle.IndentCaseLabels = false;
+ LLVMStyle.MaxEmptyLinesToKeep = 1;
LLVMStyle.ObjCSpaceBeforeProtocolList = true;
LLVMStyle.PenaltyExcessCharacter = 1000000;
LLVMStyle.PenaltyReturnTypeOnItsOwnLine = 75;
- LLVMStyle.AlignEscapedNewlinesLeft = false;
+ LLVMStyle.PointerBindsToType = false;
+ LLVMStyle.SpacesBeforeTrailingComments = 1;
+ LLVMStyle.Standard = FormatStyle::LS_Cpp03;
return LLVMStyle;
}
FormatStyle getGoogleStyle() {
FormatStyle GoogleStyle;
- GoogleStyle.ColumnLimit = 80;
- GoogleStyle.MaxEmptyLinesToKeep = 1;
- GoogleStyle.PointerBindsToType = true;
- GoogleStyle.DerivePointerBinding = true;
GoogleStyle.AccessModifierOffset = -1;
- GoogleStyle.Standard = FormatStyle::LS_Auto;
- GoogleStyle.IndentCaseLabels = true;
- GoogleStyle.SpacesBeforeTrailingComments = 2;
- GoogleStyle.BinPackParameters = true;
+ GoogleStyle.AlignEscapedNewlinesLeft = true;
GoogleStyle.AllowAllParametersOfDeclarationOnNextLine = true;
- GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
GoogleStyle.AllowShortIfStatementsOnASingleLine = true;
+ GoogleStyle.BinPackParameters = true;
+ GoogleStyle.ColumnLimit = 80;
+ GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
+ GoogleStyle.DerivePointerBinding = true;
+ GoogleStyle.IndentCaseLabels = true;
+ GoogleStyle.MaxEmptyLinesToKeep = 1;
GoogleStyle.ObjCSpaceBeforeProtocolList = false;
GoogleStyle.PenaltyExcessCharacter = 1000000;
GoogleStyle.PenaltyReturnTypeOnItsOwnLine = 200;
- GoogleStyle.AlignEscapedNewlinesLeft = true;
+ GoogleStyle.PointerBindsToType = true;
+ GoogleStyle.SpacesBeforeTrailingComments = 2;
+ GoogleStyle.Standard = FormatStyle::LS_Auto;
return GoogleStyle;
}
@@ -86,6 +86,18 @@ FormatStyle getChromiumStyle() {
return ChromiumStyle;
}
+FormatStyle getMozillaStyle() {
+ FormatStyle MozillaStyle = getLLVMStyle();
+ MozillaStyle.AllowAllParametersOfDeclarationOnNextLine = false;
+ MozillaStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
+ MozillaStyle.DerivePointerBinding = true;
+ MozillaStyle.IndentCaseLabels = true;
+ MozillaStyle.ObjCSpaceBeforeProtocolList = false;
+ MozillaStyle.PenaltyReturnTypeOnItsOwnLine = 200;
+ MozillaStyle.PointerBindsToType = true;
+ return MozillaStyle;
+}
+
// Returns the length of everything up to the first possible line break after
// the ), ], } or > matching \c Tok.
static unsigned getLengthToMatchingParen(const AnnotatedToken &Tok) {
OpenPOWER on IntegriCloud