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

2022-10-25 Thread Fangrui Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3a3603ff99ff: [clang] Replace BACKEND_PACKAGE_STRING with 
LLVM_VERSION_STRING (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

Files:
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  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}"
 
Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -37,7 +37,7 @@
   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()
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -134,10 +134,6 @@
 
 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)

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

2022-10-25 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D136660#3881647 , @mgorny wrote:

> In D136660#3881617 , @MaskRay wrote:
>
>> In D136660#3881602 , @mgorny wrote:
>>
>>> I suppose you want to remove it from `clang/CMakeLists.txt` as well. I see 
>>> Flang has copied the same logic too, so might be worthwhile to remove it 
>>> there as well.
>>
>> `set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")` and another set 
>> in `clang/CMakeLists.txt` is used by `clang/cmake/modules/AddClang.cmake`. 
>> Perhaps just simplify `VERSION_STRING "${CLANG_VERSION} 
>> (${BACKEND_PACKAGE_STRING})"` to `VERSION_STRING "${CLANG_VERSION}"` ? The 
>> backend package string is probably not useful.
>
> Perhaps it was used to account for LLVM and Clang minor version mismatch — 
> though I don't know if anyone is actually building a configuration like that.

Yes, and that's used in a minor place for a Windows build... The LLVM version 
should really not matter.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-10-25 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

In D136660#3881617 , @MaskRay wrote:

> In D136660#3881602 , @mgorny wrote:
>
>> I suppose you want to remove it from `clang/CMakeLists.txt` as well. I see 
>> Flang has copied the same logic too, so might be worthwhile to remove it 
>> there as well.
>
> `set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")` and another set 
> in `clang/CMakeLists.txt` is used by `clang/cmake/modules/AddClang.cmake`. 
> Perhaps just simplify `VERSION_STRING "${CLANG_VERSION} 
> (${BACKEND_PACKAGE_STRING})"` to `VERSION_STRING "${CLANG_VERSION}"` ? The 
> backend package string is probably not useful.

Perhaps it was used to account for LLVM and Clang minor version mismatch — 
though I don't know if anyone is actually building a configuration like that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-10-25 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Since the patch subject is called `[clang] ` I am deferring the flang cmake 
change to a separate patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-10-25 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 470383.
MaskRay edited the summary of this revision.
MaskRay added a comment.

Remove cmake variable BACKEND_PACKAGE_STRING


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

Files:
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  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}"
 
Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -37,7 +37,7 @@
   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()
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -134,10 +134,6 @@
 
 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)
___
cfe-commits mailing list

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

2022-10-25 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D136660#3881602 , @mgorny wrote:

> I suppose you want to remove it from `clang/CMakeLists.txt` as well. I see 
> Flang has copied the same logic too, so might be worthwhile to remove it 
> there as well.

`set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")` and another set in 
`clang/CMakeLists.txt` is used by `clang/cmake/modules/AddClang.cmake`. 
Perhaps just simplify `VERSION_STRING "${CLANG_VERSION} 
(${BACKEND_PACKAGE_STRING})"` to `VERSION_STRING "${CLANG_VERSION}"` ? The 
backend package string is probably not useful.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-10-25 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

I suppose you want to remove it from `clang/CMakeLists.txt` as well. I see 
Flang has copied the same logic too, so might be worthwhile to remove it there 
as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-10-24 Thread Tom Stellard via Phabricator via cfe-commits
tstellar accepted this revision.
tstellar added a comment.
This revision is now accepted and ready to land.

This seems fine to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136660/new/

https://reviews.llvm.org/D136660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-10-24 Thread Fangrui Song via Phabricator via cfe-commits
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}"
 


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
===
---