diff options
author | Linus Groh <mail@linusgroh.de> | 2022-10-17 00:05:51 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-03 23:52:23 +0000 |
commit | 8639d8bc212dcb45aff80405b4b0f6b1ef1087e7 (patch) | |
tree | 83073878beb0d27eb2d07721ec0c01751d0f7f19 /Meta/lint-clang-format.sh | |
parent | 0d63b7a51552ac85480963d498770d65229b0d13 (diff) | |
download | serenity-8639d8bc212dcb45aff80405b4b0f6b1ef1087e7.zip |
Meta: Switch to clang-format-15 as the standard formatter
The two major changes noticeable on the SerenityOS codebase are:
- Much improved support for const placement, clang-format-14 ignored
our east-const configuration in various places
- Different formatting for requires clauses, now breaking them onto
their own line, which helps with readability a bit
Current versions of CLion also ship LLVM 15, so the built-in formatting
now matches CI formatting again :^)
Diffstat (limited to 'Meta/lint-clang-format.sh')
-rwxr-xr-x | Meta/lint-clang-format.sh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Meta/lint-clang-format.sh b/Meta/lint-clang-format.sh index 6641476302..d8746c1984 100755 --- a/Meta/lint-clang-format.sh +++ b/Meta/lint-clang-format.sh @@ -28,21 +28,21 @@ fi if (( ${#files[@]} )); then TOOLCHAIN_DIR=Toolchain/Local/clang/bin CLANG_FORMAT=false - if command -v clang-format-14 >/dev/null 2>&1 ; then - CLANG_FORMAT=clang-format-14 - elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@14)"/bin/clang-format >/dev/null 2>&1 ; then - CLANG_FORMAT="$(brew --prefix llvm@14)"/bin/clang-format - elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 14.' ; then + if command -v clang-format-15 >/dev/null 2>&1 ; then + CLANG_FORMAT=clang-format-15 + elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@15)"/bin/clang-format >/dev/null 2>&1 ; then + CLANG_FORMAT="$(brew --prefix llvm@15)"/bin/clang-format + elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 15.' ; then CLANG_FORMAT=$TOOLCHAIN_DIR/clang-format elif command -v clang-format >/dev/null 2>&1 ; then CLANG_FORMAT=clang-format - if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 14) exit 1; }'; then - echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 14 or later." + if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 15) exit 1; }'; then + echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 15 or later." echo "It is very likely that the resulting changes are not what you wanted." fi else - echo "clang-format-14 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-14." - echo "(If you install a package 'clang-format', please make sure it's version 14 or later.)" + echo "clang-format-15 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-15." + echo "(If you install a package 'clang-format', please make sure it's version 15 or later.)" exit 1 fi |