From: Matthias Maier Date: Fri, 2 Jun 2017 20:59:19 +0000 (-0500) Subject: Add a .clang-format file X-Git-Tag: v9.0.0-rc1~1492^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4476%2Fhead;p=dealii.git Add a .clang-format file This commit adds a .clang-format [1] file that approximates our indent style as defined by ./contrib/styles/astyle.rc The motivation behind this commit is the simple fact that clang-format (utilizing the clang lexer and tokenizer) is a far superior indenter than any of the alternatives (including astyle). The format file tries to give a close approximation to the output of astyle. Unfortunately astyle misinterprets heavily templated stuff quite a bit, so that astyle after clang-format = clang-format does not always hold. [1] https://clang.llvm.org/docs/ClangFormatStyleOptions.html --- diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..e40e0bb2e8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,39 @@ +# +# An approximation of deal.II indent style as "defined" by +# ./contrib/styles/astyle.rc +# + +BasedOnStyle: "LLVM" + +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AlwaysBreakTemplateDeclarations: true + +BinPackArguments: false +BinPackParameters: false + +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + IndentBraces: true + +ColumnLimit: 80 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +IndentWidth: 2 +NamespaceIndentation: All +Standard: Cpp11 + +TabWidth: 4 +UseTab: Never