Commit c0c916c4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add clang-format rules and makefile targets

Will commit the result in the next changeset.

Also, had to update to a newer version of LLVM to get some new clang-format options.
We don't necessarily have to use the same version of clang-format as the version of
llvm that we build it against, but if we can it keeps the build system simpler.
parent 0b890b0b
BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignTrailingComments: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
BreakBeforeBraces: Attach
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
IndentCaseLabels: true
IndentWidth: 4
Language: Cpp
MaxEmptyLinesToKeep: 3
NamespaceIndentation: None
PointerBindsToType: true
SpaceBeforeParens: ControlStatements
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
Standard: Cpp03
TabWidth: 4
UseTab: Never
# Unset settings are undecided
......@@ -305,6 +305,12 @@ define checksha
test "$$($1 | sha1sum)" = "$2 -"
endef
.PHONY: format check_format
format:
find \( -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 $(LLVM_BIN)/clang-format -style=file -i
check_format:
$(TOOLS_DIR)/check_format.sh $(LLVM_BIN)/clang-format
.PHONY: test test_debug test_prof test_release
test_debug: pyston_dbg ext
python ../tools/tester.py -j$(TEST_THREADS) -k $(TESTS_DIR) $(ARGS)
......
#!/bin/bash
set -eu
for fn in $(find -name '*.cpp' -o -name '*.h'); do
$1 -style=file -output-replacements-xml $fn | grep -q "replacement offset" && { echo $fn "failed clang-format check"; exit 1; }
done
echo "Format checks passed"
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment