From 552f4a7e27a99d6a56bd4cefe168ad7b5ce570bb Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 31 Jul 2013 23:55:15 +0000 Subject: clang-format: Make alignment of trailing comments optional .. .. in order to support WebKit style properly. llvm-svn: 187549 --- clang/lib/Format/Format.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Format/Format.cpp') diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 65b1a265e59..290f0597f57 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -91,6 +91,7 @@ template <> struct MappingTraits { IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlinesLeft); + IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine", Style.AllowAllParametersOfDeclarationOnNextLine); IO.mapOptional("AllowShortIfStatementsOnASingleLine", @@ -153,6 +154,7 @@ FormatStyle getLLVMStyle() { FormatStyle LLVMStyle; LLVMStyle.AccessModifierOffset = -2; LLVMStyle.AlignEscapedNewlinesLeft = false; + LLVMStyle.AlignTrailingComments = true; LLVMStyle.AllowAllParametersOfDeclarationOnNextLine = true; LLVMStyle.AllowShortIfStatementsOnASingleLine = false; LLVMStyle.AllowShortLoopsOnASingleLine = false; @@ -188,6 +190,7 @@ FormatStyle getGoogleStyle() { FormatStyle GoogleStyle; GoogleStyle.AccessModifierOffset = -1; GoogleStyle.AlignEscapedNewlinesLeft = true; + GoogleStyle.AlignTrailingComments = true; GoogleStyle.AllowAllParametersOfDeclarationOnNextLine = true; GoogleStyle.AllowShortIfStatementsOnASingleLine = true; GoogleStyle.AllowShortLoopsOnASingleLine = true; @@ -245,6 +248,7 @@ FormatStyle getMozillaStyle() { FormatStyle getWebKitStyle() { FormatStyle Style = getLLVMStyle(); Style.AccessModifierOffset = -4; + Style.AlignTrailingComments = false; Style.BreakBeforeBinaryOperators = true; Style.BreakBeforeBraces = FormatStyle::BS_Stroustrup; Style.BreakConstructorInitializersBeforeComma = true; -- cgit v1.2.3