]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a .clang-format file 4476/head
authorMatthias Maier <tamiko@43-1.org>
Fri, 2 Jun 2017 20:59:19 +0000 (15:59 -0500)
committerMatthias Maier <tamiko@43-1.org>
Fri, 2 Jun 2017 21:32:15 +0000 (16:32 -0500)
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 [new file with mode: 0644]

diff --git a/.clang-format b/.clang-format
new file mode 100644 (file)
index 0000000..e40e0bb
--- /dev/null
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.