From d3e9925b42efe46b63e932fa56aa4df5dd4b6185 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 18 Aug 2017 15:07:17 -0700 Subject: [PATCH] [code-style] change to clang-format --- .astyle/astyle-opts | 16 --- .clang-format | 112 ++++++++++++++++++ .travis.yml | 8 +- .travis/before_install.sh | 8 +- .travis/script.sh | 1 - Makefile.am | 2 - configure.ac | 8 +- .../clang-format-check.sh | 15 ++- 8 files changed, 131 insertions(+), 39 deletions(-) delete mode 100644 .astyle/astyle-opts create mode 100644 .clang-format rename .astyle/astyle-wrap.sh => script/clang-format-check.sh (82%) diff --git a/.astyle/astyle-opts b/.astyle/astyle-opts deleted file mode 100644 index 3bebecd61..000000000 --- a/.astyle/astyle-opts +++ /dev/null @@ -1,16 +0,0 @@ ---style=allman ---max-code-length=120 ---max-instatement-indent=100 ---attach-namespaces --attach-inlines ---attach-extern-c ---min-conditional-indent=0 ---break-blocks ---pad-oper ---pad-header ---unpad-paren ---align-pointer=name ---add-brackets ---keep-one-line-blocks ---convert-tabs ---break-after-logical ---formatted diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..b5b25e775 --- /dev/null +++ b/.clang-format @@ -0,0 +1,112 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: false +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeCategories: + - Regex: '^