Skip to content

Commit

Permalink
[clang] Replace BACKEND_PACKAGE_STRING with LLVM_VERSION_STRING
Browse files Browse the repository at this point in the history
420d7cc introduced BACKEND_PACKAGE_STRING to
replace `PACKAGE_VERSION` (llvm/Config/config.h) to support standalone builds.
This is used in the output of `clang -cc1 -v`.

Since llvm-config.h is available for both standalone and non-standalone builds,
we can just use `LLVM_VERSION_STRING` from llvm-config.h.

clang/cmake/modules/AddClang.cmake uses `VERSION_STRING "${CLANG_VERSION} (${BACKEND_PACKAGE_STRING})"`.
Just simplify it to `"${CLANG_VERSION}"` so that we can remove the CMake
variable BACKEND_PACKAGE_STRING.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D136660
  • Loading branch information
MaskRay committed Oct 25, 2022
1 parent e6c8418 commit 3a3603f
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 22 deletions.
4 changes: 0 additions & 4 deletions clang/CMakeLists.txt
Expand Up @@ -134,10 +134,6 @@ if(CLANG_BUILT_STANDALONE)

umbrella_lit_testsuite_begin(check-all)
endif() # LLVM_INCLUDE_TESTS

set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")
else()
set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
endif() # standalone

if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
Expand Down
2 changes: 1 addition & 1 deletion clang/cmake/modules/AddClang.cmake
Expand Up @@ -37,7 +37,7 @@ macro(set_clang_windows_version_resource_properties name)
VERSION_MAJOR ${CLANG_VERSION_MAJOR}
VERSION_MINOR ${CLANG_VERSION_MINOR}
VERSION_PATCHLEVEL ${CLANG_VERSION_PATCHLEVEL}
VERSION_STRING "${CLANG_VERSION} (${BACKEND_PACKAGE_STRING})"
VERSION_STRING "${CLANG_VERSION}"
PRODUCT_NAME "clang")
endif()
endmacro()
Expand Down
3 changes: 0 additions & 3 deletions clang/include/clang/Config/config.h.cmake
Expand Up @@ -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}"

Expand Down
7 changes: 4 additions & 3 deletions clang/lib/Frontend/CompilerInstance.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -1023,9 +1024,9 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {

// 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();
Expand Down
Expand Up @@ -25,7 +25,6 @@ write_cmake_config("Config") {
"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?
Expand Down
7 changes: 0 additions & 7 deletions llvm/utils/release/bump-version.py
Expand Up @@ -121,13 +121,6 @@ def process_line(self, line: str) -> str:
)
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

Expand Down
Expand Up @@ -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 */

Expand Down

0 comments on commit 3a3603f

Please sign in to comment.