Skip to content

Commit

Permalink
Merge pull request #595 from laurynas-biveinis/llvm-19
Browse files Browse the repository at this point in the history
 Add LLVM 19 support
  • Loading branch information
laurynas-biveinis authored Sep 24, 2024
2 parents 423f1cd + eef2976 commit fffbd77
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 46 deletions.
28 changes: 14 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,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-18 main' \
'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main' \
| sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo NEEDRESTART_MODE=a apt-get install -y clang-18 \
clang-tidy-18 iwyu
sudo NEEDRESTART_MODE=a apt-get install -y clang-19 \
clang-tidy-19 iwyu
- when:
condition:
and:
Expand All @@ -65,8 +65,8 @@ jobs:
- run:
name: Installing dependencies (LLVM Release)
command: |
sudo NEEDRESTART_MODE=a apt-get install -y libomp5-18 \
llvm-18 lld-18
sudo NEEDRESTART_MODE=a apt-get install -y libomp5-19 \
llvm-19 lld-19
- run:
name: Create build environment
command: mkdir build
Expand All @@ -85,7 +85,7 @@ jobs:
export CXX=g++-$V
EXTRA_CMAKE_ARGS=()
elif [[ $COMPILER == "clang" ]]; then
V=18
V=19
export CC=clang-$V
export CXX=clang++-$V
if [[ $BUILD_TYPE == "Release" ]]; then
Expand Down Expand Up @@ -179,40 +179,40 @@ workflows:
compiler: gcc
ubsan: true
- build:
name: clang 18 Debug
name: clang 19 Debug
build_type: Debug
compiler: clang
- build:
name: clang 18 Debug with ASan
name: clang 19 Debug with ASan
build_type: Debug
compiler: clang
asan: true
- build:
name: clang 18 Debug with TSan
name: clang 19 Debug with TSan
build_type: Debug
compiler: clang
tsan: true
- build:
name: clang 18 Debug with UBSan
name: clang 19 Debug with UBSan
build_type: Debug
compiler: clang
ubsan: true
- build:
name: clang 18 Release
name: clang 19 Release
build_type: Release
compiler: clang
- build:
name: clang 18 Release with ASan
name: clang 19 Release with ASan
build_type: Release
compiler: clang
asan: true
- build:
name: clang 18 Release with TSan
name: clang 19 Release with TSan
build_type: Release
compiler: clang
tsan: true
- build:
name: clang 18 Release with UBSan
name: clang 19 Release with UBSan
build_type: Release
compiler: clang
ubsan: true
4 changes: 3 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# clang-analyzer-unix.Malloc:
# clang static analysis is run separately from clang-tidy, and this one gives
# false positives under clang-tidy.
# - boost-use-ranges: will switch to C++ standard ranges instead, no need to
# deepen the Boost dependency meanwhile.
# - bugprone-easily-swappable-parameters: too many suppressions for otherwise
# unfixable signatures
# - cppcoreguidelines-avoid-c-arrays: duplicated by modernize-avoid-c-arrays
Expand All @@ -16,7 +18,7 @@
# - hicpp-no-assembler: Valgrind client requests
# - modernize-use-equals-default: until foo() noexcept = default is accepted by
# clang
Checks: '*,-altera-id-dependent-backward-branch,-altera-struct-pack-align,-altera-unroll-loops,-bugprone-easily-swappable-parameters,-bugprone-use-after-move,-clang-diagnostic-error,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-cplusplus.Move,-clang-analyzer-unix.Malloc,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-init-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations,-fuchsia-overloaded-operator,-google-readability-braces-around-statements,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-braces-around-statements,-hicpp-explicit-conversions,-hicpp-invalid-access-moved,-hicpp-member-init,-hicpp-named-parameter,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-use-equals-default,-llvm-include-order,-llvmlibc*,-misc-no-recursion,-misc-non-private-member-variables-in-classes,-modernize-use-equals-default,-modernize-use-trailing-return-type,-portability-simd-intrinsics,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-named-parameter,-readability-magic-numbers'
Checks: '*,-altera-id-dependent-backward-branch,-altera-struct-pack-align,-altera-unroll-loops,-boost-use-ranges,-bugprone-easily-swappable-parameters,-bugprone-use-after-move,-clang-diagnostic-error,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-cplusplus.Move,-clang-analyzer-unix.Malloc,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-init-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations,-fuchsia-overloaded-operator,-google-readability-braces-around-statements,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-braces-around-statements,-hicpp-explicit-conversions,-hicpp-invalid-access-moved,-hicpp-member-init,-hicpp-named-parameter,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-use-equals-default,-llvm-include-order,-llvmlibc*,-misc-no-recursion,-misc-non-private-member-variables-in-classes,-modernize-use-equals-default,-modernize-use-trailing-return-type,-portability-simd-intrinsics,-readability-braces-around-statements,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-named-parameter,-readability-magic-numbers'
WarningsAsErrors: '*'
CheckOptions:
- key: performance-unnecessary-value-param.AllowedTypes
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,59 +97,59 @@ jobs:
os: ubuntu-22.04
COMPILER: gcc

- name: clang 18 Release
- name: clang 19 Release
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang

- name: clang 18 Release with ASan
- name: clang 19 Release with ASan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_ADDRESS: ON
COMPILER: clang

- name: clang 18 Release with TSan
- name: clang 19 Release with TSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_THREAD: ON
COMPILER: clang

- name: clang 18 Release with UBSan
- name: clang 19 Release with UBSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_UB: ON
COMPILER: clang

- name: clang 18 Debug
- name: clang 19 Debug
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang

- name: clang 18 Debug with ASan
- name: clang 19 Debug with ASan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_ADDRESS: ON
COMPILER: clang

- name: clang 18 Debug with TSan
- name: clang 19 Debug with TSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_THREAD: ON
COMPILER: clang

- name: clang 18 Debug with UBSan
- name: clang 19 Debug with UBSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_UB: ON
COMPILER: clang

- name: clang 18 Release static analysis
- name: clang 19 Release static analysis
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang
STATIC_ANALYSIS: ON

- name: clang 18 Debug static analysis
- name: clang 19 Debug static analysis
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang
Expand Down Expand Up @@ -306,26 +306,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-18 main' \
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main' \
| sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang-18 iwyu
sudo apt-get install -y clang-19 iwyu
if: runner.os == 'Linux' && env.COMPILER == 'clang'

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

Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/old-compilers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,60 @@ jobs:
COMPILER: clang
VERSION: 17

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

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

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

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

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

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

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

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

- name: GCC 10 Release
os: ubuntu-22.04
BUILD_TYPE: Release
Expand Down
1 change: 1 addition & 0 deletions art.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ template <node_type NodeType>
constexpr void db::account_growing_inode() noexcept {
static_assert(NodeType != node_type::LEAF);

// NOLINTNEXTLINE(google-readability-casting)
++growing_inode_counts[internal_as_i<NodeType>];
UNODB_DETAIL_ASSERT(growing_inode_counts[internal_as_i<NodeType>] >=
node_counts[as_i<NodeType>]);
Expand Down
1 change: 1 addition & 0 deletions art_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "global.hpp"

// IWYU pragma: no_include <__fwd/ostream.h>
// IWYU pragma: no_include <_string.h>

#include <array>
#include <cstddef>
Expand Down
26 changes: 13 additions & 13 deletions art_internal_impl.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2023 Laurynas Biveinis
// Copyright 2019-2024 Laurynas Biveinis
#ifndef UNODB_DETAIL_ART_INTERNAL_IMPL_HPP
#define UNODB_DETAIL_ART_INTERNAL_IMPL_HPP

Expand Down Expand Up @@ -855,8 +855,8 @@ class basic_inode_4 : public basic_inode_4_parent<ArtPolicy> {
constexpr void init(db &db_instance, inode16_type &source_node,
std::uint8_t child_to_delete) {
const auto reclaim_source_node{
ArtPolicy::template make_db_inode_reclaimable_ptr(&source_node,
db_instance)};
ArtPolicy::template make_db_inode_reclaimable_ptr<inode16_type>(
&source_node, db_instance)};
auto source_keys_itr = source_node.keys.byte_array.cbegin();
auto keys_itr = keys.byte_array.begin();
auto source_children_itr = source_node.children.cbegin();
Expand Down Expand Up @@ -1188,8 +1188,8 @@ class basic_inode_16 : public basic_inode_16_parent<ArtPolicy> {
constexpr void init(db &db_instance, inode4_type &source_node,
db_leaf_unique_ptr child, tree_depth depth) noexcept {
const auto reclaim_source_node{
ArtPolicy::template make_db_inode_reclaimable_ptr(&source_node,
db_instance)};
ArtPolicy::template make_db_inode_reclaimable_ptr<inode4_type>(
&source_node, db_instance)};
const auto key_byte = static_cast<std::uint8_t>(child->get_key()[depth]);

#ifdef UNODB_DETAIL_X86_64
Expand Down Expand Up @@ -1225,8 +1225,8 @@ class basic_inode_16 : public basic_inode_16_parent<ArtPolicy> {
constexpr void init(db &db_instance, inode48_type &source_node,
std::uint8_t child_to_delete) noexcept {
const auto reclaim_source_node{
ArtPolicy::template make_db_inode_reclaimable_ptr(&source_node,
db_instance)};
ArtPolicy::template make_db_inode_reclaimable_ptr<inode48_type>(
&source_node, db_instance)};
source_node.remove_child_pointer(child_to_delete, db_instance);
source_node.child_indexes[child_to_delete] = inode48_type::empty_child;

Expand Down Expand Up @@ -1485,8 +1485,8 @@ class basic_inode_48 : public basic_inode_48_parent<ArtPolicy> {
constexpr void init(db &db_instance, inode16_type &__restrict source_node,
db_leaf_unique_ptr child, tree_depth depth) noexcept {
const auto reclaim_source_node{
ArtPolicy::template make_db_inode_reclaimable_ptr(&source_node,
db_instance)};
ArtPolicy::template make_db_inode_reclaimable_ptr<inode16_type>(
&source_node, db_instance)};
auto *const __restrict child_ptr = child.release();

// TODO(laurynas): consider AVX512 scatter?
Expand Down Expand Up @@ -1517,8 +1517,8 @@ class basic_inode_48 : public basic_inode_48_parent<ArtPolicy> {
constexpr void init(db &db_instance, inode256_type &__restrict source_node,
std::uint8_t child_to_delete) noexcept {
const auto reclaim_source_node{
ArtPolicy::template make_db_inode_reclaimable_ptr(&source_node,
db_instance)};
ArtPolicy::template make_db_inode_reclaimable_ptr<inode256_type>(
&source_node, db_instance)};
const auto r{ArtPolicy::reclaim_leaf_on_scope_exit(
source_node.children[child_to_delete]
.load()
Expand Down Expand Up @@ -1875,8 +1875,8 @@ class basic_inode_256 : public basic_inode_256_parent<ArtPolicy> {
constexpr void init(db &db_instance, inode48_type &__restrict source_node,
db_leaf_unique_ptr child, tree_depth depth) noexcept {
const auto reclaim_source_node{
ArtPolicy::template make_db_inode_reclaimable_ptr(&source_node,
db_instance)};
ArtPolicy::template make_db_inode_reclaimable_ptr<inode48_type>(
&source_node, db_instance)};
unsigned children_copied = 0;
unsigned i = 0;
while (true) {
Expand Down
1 change: 1 addition & 0 deletions olc_art.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ template <node_type NodeType>
constexpr void olc_db::account_growing_inode() noexcept {
static_assert(NodeType != node_type::LEAF);

// NOLINTNEXTLINE(google-readability-casting)
growing_inode_counts[internal_as_i<NodeType>].fetch_add(
1, std::memory_order_relaxed);
}
Expand Down
4 changes: 3 additions & 1 deletion test/gtest_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2022 Laurynas Biveinis
// Copyright 2021-2024 Laurynas Biveinis
#ifndef UNODB_DETAIL_GTEST_UTILS_HPP
#define UNODB_DETAIL_GTEST_UTILS_HPP

Expand All @@ -15,7 +15,9 @@
// is not a bug: https://github.com/google/googletest/issues/2271
#define UNODB_TYPED_TEST_SUITE(Suite, Types) \
UNODB_DETAIL_DISABLE_CLANG_WARNING("-Wgnu-zero-variadic-macro-arguments") \
UNODB_DETAIL_DISABLE_CLANG_WARNING("-Wpedantic") \
TYPED_TEST_SUITE(Suite, Types); \
UNODB_DETAIL_RESTORE_CLANG_WARNINGS() \
UNODB_DETAIL_RESTORE_CLANG_WARNINGS()

#define UNODB_START_TESTS() \
Expand Down

0 comments on commit fffbd77

Please sign in to comment.