[llvm] [clang] Include LLVM_VERSION_SUFFIX in the Clang version string. (PR #74469)
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 06:00:42 PST 2023
https://github.com/jyknight updated https://github.com/llvm/llvm-project/pull/74469
>From 00f710804e77ccc001025a4524ab6882377d1089 Mon Sep 17 00:00:00 2001
From: James Y Knight <jyknight at google.com>
Date: Tue, 5 Dec 2023 08:41:08 -0500
Subject: [PATCH 1/2] Include LLVM_VERSION_SUFFIX in the Clang version string.
This causes current mainline to now report "18.0.0git" instead of
"18.0.0".
Fixes #53825
---
clang/CMakeLists.txt | 6 ++++--
clang/test/Frontend/sarif-diagnostics.cpp | 4 ++--
llvm/utils/UpdateTestChecks/common.py | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 9b52c58be41e7..65ed790e69c2a 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -290,8 +290,10 @@ endif()
if(NOT DEFINED CLANG_VERSION_PATCHLEVEL)
set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
endif()
-# Unlike PACKAGE_VERSION, CLANG_VERSION does not include LLVM_VERSION_SUFFIX.
-set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}")
+if(NOT DEFINED CLANG_VERSION_SUFFIX)
+ set(CLANG_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+endif()
+set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}${LLVM_VERSION_SUFFIX}")
message(STATUS "Clang version: ${CLANG_VERSION}")
# Configure the Version.inc file.
diff --git a/clang/test/Frontend/sarif-diagnostics.cpp b/clang/test/Frontend/sarif-diagnostics.cpp
index 9a4e686389a2e..767c5802ca13d 100644
--- a/clang/test/Frontend/sarif-diagnostics.cpp
+++ b/clang/test/Frontend/sarif-diagnostics.cpp
@@ -64,5 +64,5 @@ void f1(t1 x, t1 y) {
// CHECK: {"enabled":true,"level":"error","rank":50},"fullDescription":{"text":""},"id":"{{[0-9]+}}","name":""},{"defaultConfiguration":
// CHECK: {"enabled":true,"level":"error","rank":50},"fullDescription":{"text":""},"id":"{{[0-9]+}}","name":""},{"defaultConfiguration":
// CHECK: {"enabled":true,"level":"error","rank":50},"fullDescription":
-// CHECK: {"text":""},"id":"{{[0-9]+}}","name":""}],"version":"{{[0-9]+\.[0-9]+\.[0-9]+}}"}}}],"version":"2.1.0"}
-// CHECK: 2 warnings and 6 errors generated.
\ No newline at end of file
+// CHECK: {"text":""},"id":"{{[0-9]+}}","name":""}],"version":"{{[0-9]+\.[0-9]+\.[0-9]+[^" ]*}}"}}}],"version":"2.1.0"}
+// CHECK: 2 warnings and 6 errors generated.
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 5c3775e3d0859..0fe0dfc506b05 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -1701,7 +1701,7 @@ def add(var):
METADATA_FILTERS = [
(
- r"(?<=\")(\w+ )?(\w+ version )[\d.]+(?: \([^)]+\))?",
+ r"(?<=\")(\w+ )?(\w+ version )[\d.]+(?:[^\" ]*)(?: \([^)]+\))?",
r"{{.*}}\2{{.*}}",
), # preface with glob also, to capture optional CLANG_VENDOR
(r'(!DIFile\(filename: ".+", directory: )".+"', r"\1{{.*}}"),
>From bc27175cb8bb3a6500f1101385ad7b02badd1470 Mon Sep 17 00:00:00 2001
From: James Y Knight <jyknight at google.com>
Date: Tue, 5 Dec 2023 09:00:28 -0500
Subject: [PATCH 2/2] Meant to use CLANG_VERSION_SUFFIX.
---
clang/CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 65ed790e69c2a..2ca6db02e5879 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -293,7 +293,7 @@ endif()
if(NOT DEFINED CLANG_VERSION_SUFFIX)
set(CLANG_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
endif()
-set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}${LLVM_VERSION_SUFFIX}")
+set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}${CLANG_VERSION_SUFFIX}")
message(STATUS "Clang version: ${CLANG_VERSION}")
# Configure the Version.inc file.
@@ -652,6 +652,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
CLANG_VERSION_MAJOR
CLANG_VERSION_MINOR
CLANG_VERSION_PATCHLEVEL
+ CLANG_VERSION_SUFFIX
CLANG_VENDOR
LLVM_VERSION_SUFFIX
LLVM_BINUTILS_INCDIR
More information about the llvm-commits
mailing list