diff --git a/flang/.clang-format b/flang/.clang-format new file mode 100644 index 000000000000..7e567908d0d8 --- /dev/null +++ b/flang/.clang-format @@ -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: diff --git a/flang/.gitignore b/flang/.gitignore index ef10e3373e49..8a614a1aa83c 100644 --- a/flang/.gitignore +++ b/flang/.gitignore @@ -7,3 +7,4 @@ f18 CMakeCache.txt CMakeFiles/* cmake_install.cmake +formatted diff --git a/flang/Makefile b/flang/Makefile index a24acceada64..5d0d24203b84 100644 --- a/flang/Makefile +++ b/flang/Makefile @@ -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