Update to use clangformat9

With clangformat9 the AfterCaseLabel is introduced.
And this defaults to false, but our code is formatted
implicitly with this set to true.

PRs to Verona and Snmalloc are being formatted with clangformat9,
and this is causing complexity. Let's move forward to clangformat9
in CI.
This commit is contained in:
Matthew Parkinson
2020-02-06 09:09:32 +00:00
parent 1d72024a9f
commit cae3317964
3 changed files with 10 additions and 14 deletions

View File

@@ -21,6 +21,7 @@ AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true

View File

@@ -35,15 +35,12 @@ endmacro()
macro(clangformat_targets)
# The clang-format tool is installed under a variety of different names. Try
# to find a sensible one. Only look for versions 6 to 8 explicitly - we don't
# to find a sensible one. Only look for versions 9 explicitly - we don't
# know whether our clang-format file will work with newer versions of the
# tool
# tool. It does not work with older versions as AfterCaseLabel is not supported
# in earlier versions.
find_program(CLANG_FORMAT NAMES
clang-format-8
clang-format-7.0
clang-format-6.0
clang-format70
clang-format60
clang-format-9
clang-format)
# If we've found a clang-format tool, generate a target for it, otherwise emit

View File

@@ -225,15 +225,15 @@ jobs:
- job:
displayName: Format
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-18.04'
steps:
- script: |
set -eo pipefail
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main"
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main"
sudo apt-get update
sudo apt-get install -y clang-format-8 clang-tidy-8
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-8 100
sudo apt-get install -y clang-format-9
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-9 100
displayName: 'Install clang'
@@ -245,7 +245,6 @@ jobs:
- script: |
set -eo pipefail
make clangformat
git diff
git diff --exit-code $(Build.SourceVersion)
workingDirectory: build
@@ -254,7 +253,6 @@ jobs:
- script: |
set -eo pipefail
clang-tidy-8 src/override/malloc.cc -header-filter="`pwd`/*" -export-fixes=tidy.fail -- -std=c++17 -mcx16
if [ -f tidy.fail ] ; then exit 1 ; fi
clang-tidy-9 src/override/malloc.cc -header-filter="`pwd`/*" -warnings-as-errors='*' -export-fixes=tidy.fail -- -std=c++17 -mcx16
displayName: 'Clang-Tidy'