Skip to content

Commit

Permalink
Add LLVM 17 support
Browse files Browse the repository at this point in the history
- Fix new clang-tidy check warnings
- Add LLVM 17 to CI
  • Loading branch information
laurynas-biveinis committed Sep 19, 2023
1 parent b211bed commit dda1f80
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 39 deletions.
28 changes: 14 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ jobs:
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \
| sudo apt-key add -
echo \
'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main' \
'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' \
| sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo NEEDRESTART_MODE=a apt-get install -y clang-15 \
clang-tidy-15 iwyu
sudo NEEDRESTART_MODE=a apt-get install -y clang-17 \
clang-tidy-17 iwyu
- when:
condition:
and:
Expand All @@ -63,8 +63,8 @@ jobs:
- run:
name: Installing dependencies (LLVM Release)
command: |
sudo NEEDRESTART_MODE=a apt-get install -y libomp5-15 \
llvm-15 lld-15
sudo NEEDRESTART_MODE=a apt-get install -y libomp5-17 \
llvm-17 lld-17
- run:
name: Create build environment
command: mkdir build
Expand All @@ -83,7 +83,7 @@ jobs:
export CXX=g++-$V
EXTRA_CMAKE_ARGS=()
elif [[ $COMPILER == "clang" ]]; then
V=15
V=17
export CC=clang-$V
export CXX=clang++-$V
if [[ $BUILD_TYPE == "Release" ]]; then
Expand Down Expand Up @@ -177,40 +177,40 @@ workflows:
compiler: gcc
ubsan: true
- build:
name: clang 15 Debug
name: clang 17 Debug
build_type: Debug
compiler: clang
- build:
name: clang 15 Debug with ASan
name: clang 17 Debug with ASan
build_type: Debug
compiler: clang
asan: true
- build:
name: clang 15 Debug with TSan
name: clang 17 Debug with TSan
build_type: Debug
compiler: clang
tsan: true
- build:
name: clang 15 Debug with UBSan
name: clang 17 Debug with UBSan
build_type: Debug
compiler: clang
ubsan: true
- build:
name: clang 15 Release
name: clang 17 Release
build_type: Release
compiler: clang
- build:
name: clang 15 Release with ASan
name: clang 17 Release with ASan
build_type: Release
compiler: clang
asan: true
- build:
name: clang 15 Release with TSan
name: clang 17 Release with TSan
build_type: Release
compiler: clang
tsan: true
- build:
name: clang 15 Release with UBSan
name: clang 17 Release with UBSan
build_type: Release
compiler: clang
ubsan: true
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,59 +95,59 @@ jobs:
os: ubuntu-22.04
COMPILER: gcc

- name: clang 16 Release
- name: clang 17 Release
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang

- name: clang 16 Release with ASan
- name: clang 17 Release with ASan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_ADDRESS: ON
COMPILER: clang

- name: clang 16 Release with TSan
- name: clang 17 Release with TSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_THREAD: ON
COMPILER: clang

- name: clang 16 Release with UBSan
- name: clang 17 Release with UBSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_UB: ON
COMPILER: clang

- name: clang 16 Debug
- name: clang 17 Debug
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang

- name: clang 16 Debug with ASan
- name: clang 17 Debug with ASan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_ADDRESS: ON
COMPILER: clang

- name: clang 16 Debug with TSan
- name: clang 17 Debug with TSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_THREAD: ON
COMPILER: clang

- name: clang 16 Debug with UBSan
- name: clang 17 Debug with UBSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_UB: ON
COMPILER: clang

- name: clang 16 Release static analysis
- name: clang 17 Release static analysis
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang
STATIC_ANALYSIS: ON

- name: clang 16 Debug static analysis
- name: clang 17 Debug static analysis
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang
Expand Down Expand Up @@ -247,26 +247,26 @@ jobs:
run: |
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \
| sudo apt-key add -
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' \
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' \
| sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang-16 iwyu
sudo apt-get install -y clang-17 iwyu
if: runner.os == 'Linux' && env.COMPILER == 'clang'

- name: Setup dependencies for Linux LLVM (Release)
run: sudo apt-get install -y libomp5-16 llvm-16 lld-16
run: sudo apt-get install -y libomp5-17 llvm-17 lld-17
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& env.BUILD_TYPE == 'Release'
- name: Setup dependencies for Linux LLVM (static analysis)
run: sudo apt-get install -y clang-tools-16
run: sudo apt-get install -y clang-tools-17
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& env.STATIC_ANALYSIS == 'ON'
- name: Setup dependencies for Linux LLVM (not static analysis)
run: sudo apt-get install -y clang-tidy-16
run: sudo apt-get install -y clang-tidy-17
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& env.STATIC_ANALYSIS != 'ON'
Expand Down Expand Up @@ -318,7 +318,7 @@ jobs:
export CC=gcc-$V
export CXX=g++-$V
elif [[ $COMPILER == "clang" ]]; then
V=16
V=17
export CC=clang-$V
export CXX=clang++-$V
if [[ $BUILD_TYPE == "Release" ]]; then
Expand Down Expand Up @@ -359,7 +359,7 @@ jobs:
- name: clang static analysis
working-directory: ${{github.workspace}}/build
run: |
/usr/bin/scan-build-16 --status-bugs -stats -analyze-headers \
/usr/bin/scan-build-17 --status-bugs -stats -analyze-headers \
--force-analyze-debug-code make -j3;
if: env.STATIC_ANALYSIS == 'ON' && env.COMPILER == 'clang'

Expand Down
58 changes: 56 additions & 2 deletions .github/workflows/old-compilers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,60 @@ jobs:
COMPILER: clang
VERSION: 15

- name: clang 16 Release
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang
VERSION: 16

- name: clang 16 Release with ASan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_ADDRESS: ON
COMPILER: clang
VERSION: 16

- name: clang 16 Release with TSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_THREAD: ON
COMPILER: clang
VERSION: 16

- name: clang 16 Release with UBSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_UB: ON
COMPILER: clang
VERSION: 16

- name: clang 16 Debug
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang
VERSION: 16

- name: clang 16 Debug with ASan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_ADDRESS: ON
COMPILER: clang
VERSION: 16

- name: clang 16 Debug with TSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_THREAD: ON
COMPILER: clang
VERSION: 16

- name: clang 16 Debug with UBSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_UB: ON
COMPILER: clang
VERSION: 16

- name: GCC 10 Release
os: ubuntu-22.04
BUILD_TYPE: Release
Expand Down Expand Up @@ -425,7 +479,7 @@ jobs:
"clang-${VERSION}" "clang-tidy-${VERSION}"
if: runner.os == 'Linux' && env.COMPILER == 'clang' && env.VERSION < 13

- name: Setup dependencies for Linux LLVM 13 & 15
- name: Setup dependencies for Linux LLVM 13, 15, & 16
run: |
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \
| sudo apt-key add -
Expand All @@ -437,7 +491,7 @@ jobs:
"clang-${VERSION}" "clang-tidy-${VERSION}"
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& (env.VERSION == 13 || env.VERSION == 15)
&& (env.VERSION == 13 || env.VERSION == 15 || env.VERSION == 16)
- name: Setup dependencies for Linux LLVM 13+
run: sudo apt-get install -y iwyu
Expand Down
4 changes: 4 additions & 0 deletions art.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

#include "art.hpp"

#include <cstddef>
#include <iostream>
#include <optional>
#include <type_traits> // IWYU pragma: keep
#include <utility> // IWYU pragma: keep

#include "art_common.hpp"
#include "art_internal.hpp"
#include "art_internal_impl.hpp"
#include "assert.hpp"
#include "in_fake_critical_section.hpp"
Expand Down
5 changes: 5 additions & 0 deletions olc_art.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@

#include "olc_art.hpp"

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <memory> // IWYU pragma: keep
#include <optional>
#include <type_traits> // IWYU pragma: keep
#include <utility> // IWYU pragma: keep

#include "art_common.hpp"
#include "art_internal_impl.hpp"
#include "assert.hpp"
#include "node_type.hpp"
#include "optimistic_lock.hpp"
#include "qsbr.hpp"
#include "qsbr_ptr.hpp"

namespace unodb::detail {

Expand Down
5 changes: 5 additions & 0 deletions qsbr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@

#include "qsbr.hpp"

#include <atomic>
#include <cstdint>
#include <exception>
#include <iostream>
#include <memory>
#include <mutex>
#include <new>
#include <utility>

#ifdef UNODB_DETAIL_THREAD_SANITIZER
#include <sanitizer/tsan_interface.h>
Expand Down
7 changes: 5 additions & 2 deletions qsbr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// IWYU pragma: no_include <__utility/forward.h>
// IWYU pragma: no_include <__utility/move.h>
// IWYU pragma: no_include <__mutex_base>
// IWYU pragma: no_include <boost/cstdint.hpp>
// IWYU pragma: no_include <boost/fusion/iterator/deref.hpp>

#include <atomic>
Expand Down Expand Up @@ -1141,9 +1142,11 @@ class [[nodiscard]] qsbr_thread : public std::thread {
[[nodiscard]] static auto make_qsbr_thread(Function &&f, Args &&...args) {
auto new_qsbr_thread_reclamator = std::make_unique<qsbr_per_thread>();
return std::thread{
[new_qsbr_thread_reclamator = std::move(new_qsbr_thread_reclamator)](
[inner_new_qsbr_thread_reclamator =
std::move(new_qsbr_thread_reclamator)](
auto &&f2, auto &&...args2) mutable noexcept(noexcept(f2)) {
qsbr_per_thread::set_instance(std::move(new_qsbr_thread_reclamator));
qsbr_per_thread::set_instance(
std::move(inner_new_qsbr_thread_reclamator));
f2(std::forward<Args>(args2)...);
},
std::forward<Function>(f), std::forward<Args>(args)...};
Expand Down
4 changes: 2 additions & 2 deletions qsbr_ptr.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (C) 2021-2022 Laurynas Biveinis
// Copyright (C) 2021-2023 Laurynas Biveinis

#include "global.hpp" // IWYU pragma: keep

#include "qsbr_ptr.hpp"
#include "qsbr_ptr.hpp" // IWYU pragma: keep

#ifndef NDEBUG
#include "qsbr.hpp"
Expand Down
1 change: 1 addition & 0 deletions qsbr_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// IWYU pragma: no_include <__iterator/iterator_traits.h>
// IWYU pragma: no_include <__type_traits/add_lvalue_reference.h>
// IWYU pragma: no_include <__utility/exchange.h>
// IWYU pragma: no_include <ext/type_traits>

#include "global.hpp"

Expand Down
4 changes: 3 additions & 1 deletion test/qsbr_gtest_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright 2022 Laurynas Biveinis
// Copyright 2022-2023 Laurynas Biveinis

#include "global.hpp"

#include "qsbr_gtest_utils.hpp"

#include "qsbr.hpp"
#include "qsbr_test_utils.hpp"

namespace unodb::test {
Expand Down
2 changes: 1 addition & 1 deletion test_heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "global.hpp" // IWYU pragma: keep

#include "test_heap.hpp"
#include "test_heap.hpp" // IWYU pragma: keep

// - ASan/TSan do not work with replaced global new/delete:
// https://github.com/llvm/llvm-project/issues/20034
Expand Down

0 comments on commit dda1f80

Please sign in to comment.