From d602db5d71859f346d3dd1ecc68ded198d8ccf64 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 2 Jun 2017 15:59:19 -0500 Subject: [PATCH] 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 --- .clang-format | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .clang-format 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 -- 2.39.5