Skip to content

Commit

Permalink
Upgrade clang (#85)
Browse files Browse the repository at this point in the history
* Upgrade clang to 19.1.7
Enable bazelmod
Deal with a silly formattign inconsistency

* Revert abseil back to 20240116.1
  • Loading branch information
helly25 authored Feb 15, 2025
1 parent c4596b6 commit 1d2f062
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To debug bazel options, uncomment next line.
# common --announce_rc

common --noenable_bzlmod
common --enable_bzlmod
common --noincompatible_enable_cc_toolchain_resolution

# Define the Apple OS
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
/.cache/
/.vscode/

MODULE.bazel
MODULE.bazel.lock
35 changes: 35 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "platforms", version = "0.0.11")

# TODO: Remove when protobuf is released with a version of rules_python that supports 8.x
#bazel_dep(name = "rules_python", version = "1.0.0", dev_dependency = True)

bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "com_google_absl")
bazel_dep(name = "re2", version = "2024-07-02.bcr.1", repo_name = "com_googlesource_code_re2")
bazel_dep(name = "googletest", version = "1.16.0", repo_name = "com_google_googletest")
bazel_dep(name = "google_benchmark", version = "1.9.1", repo_name = "com_github_google_benchmark")
bazel_dep(name = "protobuf", version = "30.0-rc1", repo_name = "com_google_protobuf")
bazel_dep(name = "toolchains_llvm", version = "1.3.0")

git_override(
module_name = "toolchains_llvm",
remote = "https://github.com/bazel-contrib/toolchains_llvm",
commit = "e831f94a8b7f3a39391f5822adcab8e4d443c03b", # Add more tools by default (#463)
)

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")

llvm.toolchain(
name = "llvm_toolchain_llvm",
llvm_version = "19.1.7",
)
use_repo(llvm, "llvm_toolchain_llvm")
register_toolchains("@llvm_toolchain_llvm//:all")
32 changes: 8 additions & 24 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ workspace(name = "com_helly25_mbo")

load(":workspace.bzl", "mbo_workspace_load_modules")

#load("@bazel_features//:deps.bzl", "bazel_features_deps")
#bazel_features_deps()

mbo_workspace_load_modules()

###########################################################################
Expand All @@ -33,6 +36,10 @@ rules_foreign_cc_dependencies()

###########################################################################

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

###########################################################################

load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")

bazel_toolchain_dependencies()
Expand All @@ -41,30 +48,7 @@ load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")

llvm_toolchain(
name = "llvm_toolchain",
llvm_versions = {
"linux-aarch64": "17.0.6",
"linux-x86_64": "17.0.6",
"darwin-aarch64": "17.0.6",
"darwin-x86_64": "15.0.7", # For Intel based macs.
},
sha256 = {
"linux-aarch64": "6dd62762285326f223f40b8e4f2864b5c372de3f7de0731cb7cd55ca5287b75a",
"linux-x86_64": "884ee67d647d77e58740c1e645649e29ae9e8a6fe87c1376be0f3a30f3cc9ab3",
"darwin-aarch64": "1264eb3c2a4a6d5e9354c3e5dc5cb6c6481e678f6456f36d2e0e566e9400fcad",
"darwin-x86_64": "d16b6d536364c5bec6583d12dd7e6cf841b9f508c4430d9ee886726bd9983f1c",
},
strip_prefix = {
"linux-aarch64": "clang+llvm-17.0.6-aarch64-linux-gnu",
"linux-x86_64": "clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04",
"darwin-aarch64": "clang+llvm-17.0.6-arm64-apple-darwin22.0",
"darwin-x86_64": "clang+llvm-15.0.7-x86_64-apple-darwin21.0",
},
urls = {
"linux-aarch64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-aarch64-linux-gnu.tar.xz"],
"linux-x86_64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz"],
"darwin-aarch64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-arm64-apple-darwin22.0.tar.xz"],
"darwin-x86_64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz"],
},
llvm_version = "19.1.7",
)

load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
Expand Down
4 changes: 2 additions & 2 deletions mbo/types/internal/decompose_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ auto DecomposeCountFunc(T&& v) {
}

template<typename T>
struct DecomposeCountImpl : decltype(DecomposeCountFunc(std::declval<T>())) {};
struct DecomposeCountImpl : decltype(DecomposeCountFunc(std::declval<T>())) /**/ {};

template<>
struct DecomposeCountImpl<void> : std::integral_constant<std::size_t, kNotDecomposableValue> {};
Expand Down Expand Up @@ -645,7 +645,7 @@ struct DecomposeInfo final {
static constexpr bool kDecomposable = !kBadFieldCount && kIsAggregate && !kIsEmpty
&& ((kOneNonEmptyBase || kOnlyEmptyBases) && !kOneNonEmptyBasePlusFields);
static constexpr std::size_t kDecomposeCount = // First check whether T is composable
kDecomposable
kDecomposable // format-NL
? (kCountBases + kCountEmptyBases == 0 // If it is, then check whether there are any bases.
? kInitializerCount
: kFieldCount - kCountEmptyBases)
Expand Down
4 changes: 2 additions & 2 deletions mbo/types/internal/decompose_count.h.mope
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ auto DecomposeCountFunc(T&& v) {
};

template<typename T>
struct DecomposeCountImpl: decltype(DecomposeCountFunc(std::declval<T>())) {};
struct DecomposeCountImpl: decltype(DecomposeCountFunc(std::declval<T>())) /**/ {};

template<>
struct DecomposeCountImpl<void>: std::integral_constant<std::size_t, kNotDecomposableValue> {};
Expand Down Expand Up @@ -458,7 +458,7 @@ struct DecomposeInfo final {
!kBadFieldCount && kIsAggregate && !kIsEmpty &&
((kOneNonEmptyBase || kOnlyEmptyBases) && !kOneNonEmptyBasePlusFields);
static constexpr std::size_t kDecomposeCount = // First check whether T is composable
kDecomposable
kDecomposable // format-NL
? (kCountBases + kCountEmptyBases == 0 // If it is, then check whether there are any bases.
? kInitializerCount
: kFieldCount - kCountEmptyBases)
Expand Down
22 changes: 20 additions & 2 deletions workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ def mbo_workspace_load_modules():
],
)

http_archive(
name = "bazel_features",
sha256 = "95fb3cfd11466b4cad6565e3647a76f89886d875556a4b827c021525cb2482bb",
strip_prefix = "bazel_features-1.25.0",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.25.0/bazel_features-v1.25.0.tar.gz",
)

http_archive(
name = "rules_foreign_cc",
sha256 = "476303bd0f1b04cc311fc258f1708a5f6ef82d3091e53fd1977fa20383425a6a",
Expand Down Expand Up @@ -98,17 +105,28 @@ def mbo_workspace_load_modules():
sha256 = "348a643defa9ab34ed9cb2ed1dc54b1c4ffef1282240aa24c457ebd8385ff2d5",
)

github_archive(
name = "com_google_protobuf",
repo = "https://github.com/protocolbuffers/protobuf",
commit = "b407e8416e3893036aee5af9a12bd9b6a0e2b2e6", # v29.3
integrity = "sha256-VZElRjOEM/RlpVLp7wmTDGO562lwU5N0FokM/4OoYi0=",
)

# Cannot yet support toolchains_llvm 1.0.0. It enables C++20 modules in a broken way.
# Minimum requirements:
# * 2023.10.06: https://github.com/bazel-contrib/toolchains_llvm/pull/229: Move minimum supported version to Bazel
# * 2024.03.12: https://github.com/bazel-contrib/toolchains_llvm/pull/286: Support LLD linker for Darwin
# * 2025.01.22: https://github.com/bazel-contrib/toolchains_llvm/pull/446: Verion 1.3.0:
# b3c96d2dbc698eab752366bbe747e2a7df7fa504 / sha256-ZDefpvZja99JcCg37NO4dkdH11yN2zMrx2D77sWlWug=
# * 2025.02.15: https://github.com/bazel-contrib/toolchains_llvm/pull/461: Add LLVM 19.1.4...19.1.7:
# 0bd3bff40ab51a8e744ccddfd24f311a9df81c2d / sha256-YpBdoaSAXSatJwLcB2yzuZw5Ls/h5+dcWip+h+pVdUo=
# In order to go past version 1.0.0 we also add the actual fix:
# * 2024.06.06: https://github.com/bazel-contrib/toolchains_llvm/pull/337: Force Clang modules with LLVM >= 14q
github_archive(
name = "toolchains_llvm",
commit = "b193952cdb9dd3134f51159d820614ff32dba079", # https://github.com/bazel-contrib/toolchains_llvm/pull/337
commit = "0bd3bff40ab51a8e744ccddfd24f311a9df81c2d",
repo = "https://github.com/bazel-contrib/toolchains_llvm",
integrity = "sha256-eqCfrC/cwTsdE2+DkJQKQmxtlM8mb/nNaZSdg2H8dbk=",
integrity = "sha256-YpBdoaSAXSatJwLcB2yzuZw5Ls/h5+dcWip+h+pVdUo=",
)
#http_archive(
# name = "toolchains_llvm",
Expand Down

0 comments on commit 1d2f062

Please sign in to comment.