[clang] 31aebdd - Include LLVM_VERSION_SUFFIX in the Clang version string. (#74469)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 09:20:17 PST 2023


Author: James Y Knight
Date: 2023-12-05T12:20:12-05:00
New Revision: 31aebdd8919b7bef4bbfe1d7988708215a8b953f

URL: https://github.com/llvm/llvm-project/commit/31aebdd8919b7bef4bbfe1d7988708215a8b953f
DIFF: https://github.com/llvm/llvm-project/commit/31aebdd8919b7bef4bbfe1d7988708215a8b953f.diff

LOG: Include LLVM_VERSION_SUFFIX in the Clang version string. (#74469)

This causes current mainline to now report "18.0.0git" instead of
"18.0.0".

Fixes #53825

Added: 
    

Modified: 
    clang/CMakeLists.txt
    clang/test/Frontend/sarif-diagnostics.cpp
    llvm/utils/UpdateTestChecks/common.py

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 9b52c58be41e7..2ca6db02e5879 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}${CLANG_VERSION_SUFFIX}")
 message(STATUS "Clang version: ${CLANG_VERSION}")
 
 # Configure the Version.inc file.
@@ -650,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

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{{.*}}"),


        


More information about the cfe-commits mailing list