llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Dimitry Andric (DimitryAndric)

<details>
<summary>Changes</summary>

In 9a38a72f1d482 `ProductId` was assigned from the stringified value of 
`CLANG_VENDOR`, if that macro was defined. However, `CLANG_VENDOR` is supposed 
to be a string, as it is defined (optionally) as such in the top-level clang 
`CMakeLists.txt`.

Move the addition of `-DCLANG_VENDOR` to the compiler flags from 
`clang/lib/Basic/CMakeLists.txt` to the top-level `CMakeLists.txt`, so it is 
consistent across the whole clang codebase. Then remove the stringification 
from `CodeGenModule.cpp`, to make it work correctly.

Fixes:          9a38a72f1d482

---
Full diff: https://github.com/llvm/llvm-project/pull/75935.diff


3 Files Affected:

- (modified) clang/CMakeLists.txt (+4) 
- (modified) clang/lib/Basic/CMakeLists.txt (-5) 
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-1) 


``````````diff
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 2ca6db02e58791..c7461bc510e4ac 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -241,6 +241,10 @@ set(CLANG_SYSTEMZ_DEFAULT_ARCH "z10" CACHE STRING "SystemZ 
Default Arch")
 set(CLANG_VENDOR ${PACKAGE_VENDOR} CACHE STRING
   "Vendor-specific text for showing with version information.")
 
+if(CLANG_VENDOR)
+  add_definitions(-DCLANG_VENDOR="${CLANG_VENDOR}")
+endif()
+
 set(CLANG_REPOSITORY_STRING "" CACHE STRING
   "Vendor-specific text for showing the repository the source is taken from.")
 
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index 2e218ba7c84cca..6b6fde9b5a9a6b 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -49,11 +49,6 @@ set_source_files_properties("${version_inc}"
   PROPERTIES GENERATED TRUE
              HEADER_FILE_ONLY TRUE)
 
-if(CLANG_VENDOR)
-  set_source_files_properties(Version.cpp
-    PROPERTIES COMPILE_DEFINITIONS "CLANG_VENDOR=\"${CLANG_VENDOR} \"")
-endif()
-
 add_clang_library(clangBasic
   Attributes.cpp
   Builtins.cpp
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index 7ad26ace328ab2..c8007aef675cb4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -997,7 +997,7 @@ void CodeGenModule::Release() {
                               uint32_t(CLANG_VERSION_PATCHLEVEL));
     std::string ProductId;
 #ifdef CLANG_VENDOR
-    ProductId = #CLANG_VENDOR;
+    ProductId = CLANG_VENDOR;
 #else
     ProductId = "clang";
 #endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/75935
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to