From b78b205efb87dd9fb3a27697efaff13313aebfd2 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 2 Sep 2021 10:58:52 -0700 Subject: [PATCH] Upgrade clang-format and clang-tidy to LLVM-12 (#6233) --- .clang-tidy | 1 + .github/workflows/presubmit.yml | 12 ++++++------ Makefile | 4 ++-- run-clang-format.sh | 14 +++++++------- run-clang-tidy.sh | 14 +++++++------- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index e05f58748c9f..47ff3d0b6dcc 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -30,6 +30,7 @@ Checks: > performance-*, -performance-inefficient-string-concatenation, -performance-inefficient-vector-operation, + -performance-no-int-to-ptr, readability-avoid-const-params-in-decls, readability-braces-around-statements, readability-const-return-type, diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index b6b70fcc6265..b370b2fe4848 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -15,11 +15,11 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - uses: DoozyX/clang-format-lint-action@v0.11 + - uses: DoozyX/clang-format-lint-action@v0.12 with: source: '.' extensions: 'h,c,cpp' - clangFormatVersion: 11 + clangFormatVersion: 12 check_clang_tidy: name: Check clang-tidy runs-on: ubuntu-20.04 @@ -28,12 +28,12 @@ jobs: - name: Install clang-tidy run: | sudo apt-get update - sudo apt-get install llvm-11 clang-11 liblld-11-dev libclang-11-dev clang-tidy-11 ninja-build + sudo apt-get install llvm-12 clang-12 liblld-12-dev libclang-12-dev clang-tidy-12 ninja-build - name: Run clang-tidy run: | - export CC=clang-11 - export CXX=clang++-11 - export CLANG_TIDY_LLVM_INSTALL_DIR=/usr/lib/llvm-11 + export CC=clang-12 + export CXX=clang++-12 + export CLANG_TIDY_LLVM_INSTALL_DIR=/usr/lib/llvm-12 ./run-clang-tidy.sh check_cmake_file_lists: name: Check CMake file lists diff --git a/Makefile b/Makefile index 2628bbdccd55..28bd8e7cb4a9 100644 --- a/Makefile +++ b/Makefile @@ -2336,7 +2336,7 @@ $(BIN_DIR)/HalideTraceDump: $(ROOT_DIR)/util/HalideTraceDump.cpp $(ROOT_DIR)/uti # Note: you must have CLANG_FORMAT_LLVM_INSTALL_DIR set for this rule to work. # Let's default to the Ubuntu install location. -CLANG_FORMAT_LLVM_INSTALL_DIR ?= /usr/lib/llvm-11 +CLANG_FORMAT_LLVM_INSTALL_DIR ?= /usr/lib/llvm-12 .PHONY: format format: @@ -2344,7 +2344,7 @@ format: # Note: you must have CLANG_TIDY_LLVM_INSTALL_DIR set for these rules to work. # Let's default to the Ubuntu install location. -CLANG_TIDY_LLVM_INSTALL_DIR ?= /usr/lib/llvm-11 +CLANG_TIDY_LLVM_INSTALL_DIR ?= /usr/lib/llvm-12 .PHONY: clang-tidy clang-tidy: diff --git a/run-clang-format.sh b/run-clang-format.sh index 52988b42c629..a09cfc27e824 100755 --- a/run-clang-format.sh +++ b/run-clang-format.sh @@ -4,23 +4,23 @@ set -e ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -# We are currently standardized on using LLVM/Clang11 for this script. +# We are currently standardized on using LLVM/Clang12 for this script. # Note that this is totally independent of the version of LLVM that you -# are using to build Halide itself. If you don't have LLVM11 installed, +# are using to build Halide itself. If you don't have LLVM12 installed, # you can usually install what you need easily via: # -# sudo apt-get install llvm-11 clang-11 libclang-11-dev clang-tidy-11 -# export CLANG_FORMAT_LLVM_INSTALL_DIR=/usr/lib/llvm-11 +# sudo apt-get install llvm-12 clang-12 libclang-12-dev clang-tidy-12 +# export CLANG_FORMAT_LLVM_INSTALL_DIR=/usr/lib/llvm-12 [ -z "$CLANG_FORMAT_LLVM_INSTALL_DIR" ] && echo "CLANG_FORMAT_LLVM_INSTALL_DIR must point to an LLVM installation dir for this script." && exit echo CLANG_FORMAT_LLVM_INSTALL_DIR = ${CLANG_FORMAT_LLVM_INSTALL_DIR} VERSION=$(${CLANG_FORMAT_LLVM_INSTALL_DIR}/bin/clang-format --version) -if [[ ${VERSION} =~ .*version\ 11.* ]] +if [[ ${VERSION} =~ .*version\ 12.* ]] then - echo "clang-format version 11 found." + echo "clang-format version 12 found." else - echo "CLANG_FORMAT_LLVM_INSTALL_DIR must point to an LLVM 11 install!" + echo "CLANG_FORMAT_LLVM_INSTALL_DIR must point to an LLVM 12 install!" exit 1 fi diff --git a/run-clang-tidy.sh b/run-clang-tidy.sh index 91197ba9af09..379d1d0d40bd 100755 --- a/run-clang-tidy.sh +++ b/run-clang-tidy.sh @@ -8,23 +8,23 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" FIX=$1 -# We are currently standardized on using LLVM/Clang11 for this script. +# We are currently standardized on using LLVM/Clang12 for this script. # Note that this is totally independent of the version of LLVM that you -# are using to build Halide itself. If you don't have LLVM11 installed, +# are using to build Halide itself. If you don't have LLVM12 installed, # you can usually install what you need easily via: # -# sudo apt-get install llvm-11 clang-11 libclang-11-dev clang-tidy-11 -# export CLANG_TIDY_LLVM_INSTALL_DIR=/usr/lib/llvm-11 +# sudo apt-get install llvm-12 clang-12 libclang-12-dev clang-tidy-12 +# export CLANG_TIDY_LLVM_INSTALL_DIR=/usr/lib/llvm-12 [ -z "$CLANG_TIDY_LLVM_INSTALL_DIR" ] && echo "CLANG_TIDY_LLVM_INSTALL_DIR must point to an LLVM installation dir for this script." && exit echo CLANG_TIDY_LLVM_INSTALL_DIR = ${CLANG_TIDY_LLVM_INSTALL_DIR} VERSION=$(${CLANG_TIDY_LLVM_INSTALL_DIR}/bin/clang-tidy --version) -if [[ ${VERSION} =~ .*version\ 11.* ]] +if [[ ${VERSION} =~ .*version\ 12.* ]] then - echo "clang-tidy version 11 found." + echo "clang-tidy version 12 found." else - echo "CLANG_TIDY_LLVM_INSTALL_DIR must point to an LLVM 11 install!" + echo "CLANG_TIDY_LLVM_INSTALL_DIR must point to an LLVM 12 install!" exit 1 fi