diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel @@ -7,6 +7,14 @@ load("//llvm:binary_alias.bzl", "binary_alias") load("//llvm:cc_plugin_library.bzl", "cc_plugin_library") +load( + "//:vars.bzl", + "LLVM_VERSION", + "LLVM_VERSION_MAJOR", + "LLVM_VERSION_MINOR", + "LLVM_VERSION_PATCH", +) + package( default_visibility = ["//visibility:public"], ) @@ -359,11 +367,11 @@ name = "basic_version_gen", outs = ["include/clang/Basic/Version.inc"], cmd = ( - "echo '#define CLANG_VERSION 16.0.0' >> $@\n" + - "echo '#define CLANG_VERSION_MAJOR 16' >> $@\n" + - "echo '#define CLANG_VERSION_MINOR 0' >> $@\n" + - "echo '#define CLANG_VERSION_PATCHLEVEL 0' >> $@\n" + - "echo '#define CLANG_VERSION_STRING \"16.0.0\"' >> $@\n" + "echo '#define CLANG_VERSION "+LLVM_VERSION+"' >> $@\n" + + "echo '#define CLANG_VERSION_MAJOR "+LLVM_VERSION_MAJOR+"' >> $@\n" + + "echo '#define CLANG_VERSION_MINOR "+LLVM_VERSION_MINOR+"' >> $@\n" + + "echo '#define CLANG_VERSION_PATCHLEVEL "+LLVM_VERSION_PATCH+"' >> $@\n" + + "echo '#define CLANG_VERSION_STRING \""+LLVM_VERSION+"\"' >> $@\n" ), ) @@ -373,6 +381,9 @@ "include/clang/Basic/Version.inc", "include/clang/Config/config.h", ], + defines = [ + r'BACKEND_PACKAGE_STRING=\"LLVM\ '+LLVM_VERSION+r'git\"', + ], includes = ["include"], deps = [ # We rely on the LLVM config library to provide configuration defines. diff --git a/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h b/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h --- a/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h +++ b/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h @@ -75,7 +75,7 @@ /* CLANG_HAVE_RLIMITS defined conditionally below */ /* The LLVM product name and version */ -#define BACKEND_PACKAGE_STRING "LLVM 16.0.0git" +/* #undef BACKEND_PACKAGE_STRING */ /* Linker version detected at compile time. */ /* #undef HOST_LINK_VERSION */ diff --git a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel @@ -5,6 +5,11 @@ load("@bazel_skylib//rules:expand_template.bzl", "expand_template") load("//llvm:tblgen.bzl", "gentbl") +load( + "//:vars.bzl", + "LLVM_VERSION", +) + package( default_visibility = ["//visibility:public"], ) @@ -15,7 +20,7 @@ genrule( name = "config_version_gen", outs = ["include/lld/Common/Version.inc"], - cmd = "echo '#define LLD_VERSION_STRING \"16.0.0\"' > $@", + cmd = "echo '#define LLD_VERSION_STRING \""+LLVM_VERSION+"\"' > $@", ) genrule( diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl --- a/utils/bazel/llvm-project-overlay/llvm/config.bzl +++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl @@ -4,6 +4,14 @@ """Defines variables that use selects to configure LLVM based on platform.""" +load( + "//:vars.bzl", + "LLVM_VERSION", + "LLVM_VERSION_MAJOR", + "LLVM_VERSION_MINOR", + "LLVM_VERSION_PATCH", +) + def native_arch_defines(arch, triple): return [ r'LLVM_NATIVE_ARCH=\"{}\"'.format(arch), @@ -89,6 +97,10 @@ "@bazel_tools//src/conditions:linux_s390x": native_arch_defines("SystemZ", "systemz-unknown-linux_gnu"), "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"), }) + [ + "LLVM_VERSION_MAJOR="+LLVM_VERSION_MAJOR, + "LLVM_VERSION_MINOR="+LLVM_VERSION_MINOR, + "LLVM_VERSION_PATCH="+LLVM_VERSION_PATCH, + r'LLVM_VERSION_STRING=\"'+LLVM_VERSION+r'git\"', # These shouldn't be needed by the C++11 standard, but are for some # platforms (e.g. glibc < 2.18. See # https://sourceware.org/bugzilla/show_bug.cgi?id=15366). These are also diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h +++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h @@ -74,16 +74,16 @@ #define LLVM_USE_PERF 0 /* Major version of the LLVM API */ -#define LLVM_VERSION_MAJOR 16 +/* #undef LLVM_VERSION_MAJOR */ /* Minor version of the LLVM API */ -#define LLVM_VERSION_MINOR 0 +/* #undef LLVM_VERSION_MINOR */ /* Patch version of the LLVM API */ -#define LLVM_VERSION_PATCH 0 +/* #undef LLVM_VERSION_PATCH */ /* LLVM version string */ -#define LLVM_VERSION_STRING "16.0.0git" +/* #undef LLVM_VERSION_STRING */ /* Whether LLVM records statistics for use with GetStatistics(), * PrintStatistics() or PrintStatisticsJSON()