[flang] Add .clang-format and "make formatted" rule.

Original-commit: flang-compiler/f18@5ef28a6112
This commit is contained in:
Tim Keith 2018-02-05 10:18:38 -08:00
parent ac12232e68
commit 340a4320b4
3 changed files with 31 additions and 0 deletions

20
flang/.clang-format Normal file
View File

@ -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:

1
flang/.gitignore vendored
View File

@ -7,3 +7,4 @@ f18
CMakeCache.txt
CMakeFiles/*
cmake_install.cmake
formatted

View 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