[PATCH] D136660: [clang] Replace BACKEND_PACKAGE_STRING with LLVM_VERSION_STRING

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 21:03:58 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: mgorny, thieta, tstellar.
Herald added a subscriber: StephenFan.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

420d7ccbac0f499a6ff9595bdbfa99cd3376df22 introduced BACKEND_PACKAGE_STRING to
replace `PACKAGE_VERSION` (llvm/Config/config.h) to support standalone builds.
Since llvm-config.h is available for both standalone and non-standalone builds,
we can just use `LLVM_VERSION_STRING` from llvm-config.h.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136660

Files:
  clang/include/clang/Config/config.h.cmake
  clang/lib/Frontend/CompilerInstance.cpp
  llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
  llvm/utils/release/bump-version.py
  utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h


Index: utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
===================================================================
--- utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
+++ utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
@@ -74,9 +74,6 @@
 /* Define if we have sys/resource.h (rlimits) */
 /* CLANG_HAVE_RLIMITS defined conditionally below */
 
-/* The LLVM product name and version */
-#define BACKEND_PACKAGE_STRING "LLVM 16.0.0git"
-
 /* Linker version detected at compile time. */
 /* #undef HOST_LINK_VERSION */
 
Index: llvm/utils/release/bump-version.py
===================================================================
--- llvm/utils/release/bump-version.py
+++ llvm/utils/release/bump-version.py
@@ -121,13 +121,6 @@
                 )
                 if nline != line:
                     break
-        # Match the BACKEND_PACKAGE_STRING in clang/config.h
-        elif "BACKEND_PACKAGE_STRING" in line:
-            nline = re.sub(
-                r'#define BACKEND_PACKAGE_STRING "LLVM ([0-9\.rcgit-]+)"',
-                f'#define BACKEND_PACKAGE_STRING "LLVM {self.version_str()}"',
-                line,
-            )
 
         return nline
 
Index: llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -25,7 +25,6 @@
     "CLANG_SPAWN_CC1=",
     "DEFAULT_SYSROOT=",
     "GCC_INSTALL_PREFIX=",
-    "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}git",
     "ENABLE_LINKER_BUILD_ID=",
     "ENABLE_X86_RELAX_RELOCATIONS=1",
     "CLANG_ENABLE_OBJC_REWRITER=1",  # FIXME: flag?
Index: clang/lib/Frontend/CompilerInstance.cpp
===================================================================
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -41,6 +41,7 @@
 #include "clang/Serialization/InMemoryModuleCache.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Errc.h"
@@ -1023,9 +1024,9 @@
 
   // Validate/process some options.
   if (getHeaderSearchOpts().Verbose)
-    OS << "clang -cc1 version " CLANG_VERSION_STRING
-       << " based upon " << BACKEND_PACKAGE_STRING
-       << " default target " << llvm::sys::getDefaultTargetTriple() << "\n";
+    OS << "clang -cc1 version " CLANG_VERSION_STRING << " based upon LLVM "
+       << LLVM_VERSION_STRING << " default target "
+       << llvm::sys::getDefaultTargetTriple() << "\n";
 
   if (getCodeGenOpts().TimePasses)
     createFrontendTimer();
Index: clang/include/clang/Config/config.h.cmake
===================================================================
--- clang/include/clang/Config/config.h.cmake
+++ clang/include/clang/Config/config.h.cmake
@@ -60,9 +60,6 @@
 /* Define if we have sys/resource.h (rlimits) */
 #cmakedefine CLANG_HAVE_RLIMITS ${CLANG_HAVE_RLIMITS}
 
-/* The LLVM product name and version */
-#define BACKEND_PACKAGE_STRING "${BACKEND_PACKAGE_STRING}"
-
 /* Linker version detected at compile time. */
 #cmakedefine HOST_LINK_VERSION "${HOST_LINK_VERSION}"
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136660.470368.patch
Type: text/x-patch
Size: 3350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221025/a582ad9a/attachment.bin>


More information about the cfe-commits mailing list