[flang] Add .clang-format and "make formatted" rule.
authorTim Keith <tkeith@nvidia.com>
Mon, 5 Feb 2018 18:18:38 +0000 (10:18 -0800)
committerTim Keith <tkeith@nvidia.com>
Mon, 5 Feb 2018 18:18:38 +0000 (10:18 -0800)
Original-commit: flang-compiler/f18@5ef28a6112698b8d99b1922ca708e19ae6327176

flang/.clang-format [new file with mode: 0644]
flang/.gitignore
flang/Makefile

diff --git a/flang/.clang-format b/flang/.clang-format
new file mode 100644 (file)
index 0000000..7e56790
--- /dev/null
@@ -0,0 +1,20 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+SpacesBeforeTrailingComments: 2
+AlignEscapedNewlines: DontAlign
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortIfStatementsOnASingleLine: true
+ConstructorInitializerIndentWidth: 2
+AlignAfterOpenBracket: AlwaysBreak
+AlignOperands: false
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignTrailingComments: false
+SpaceAfterTemplateKeyword: false
+BreakBeforeBinaryOperators: All
+BreakBeforeTernaryOperators: true
+ContinuationIndentWidth: 2
+...
+
+# vim:set filetype=yaml:
index ef10e33..8a614a1 100644 (file)
@@ -7,3 +7,4 @@ f18
 CMakeCache.txt
 CMakeFiles/*
 cmake_install.cmake
+formatted
index a24acce..5d0d242 100644 (file)
@@ -51,3 +51,13 @@ parse-state.h: message.h position.h
        @touch $@
 parse-tree.h: format-specification.h idioms.h indirection.h position.h
        @touch $@
+
+
+CLANG_FORMAT=/proj/pgi/flang/x86_64/flang-dev/bin/clang-format
+formatted:
+       @mkdir -p formatted
+       @for x in *.h *.cc; do \
+               $(CLANG_FORMAT) < $$x > formatted/$$x; \
+       done
+
+.PHONY: formatted