[clang] [clang] Add getClangVendor() and use it in CodeGenModule.cpp (PR #75935)

Dimitry Andric via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 20 04:54:00 PST 2023


================
@@ -995,12 +995,7 @@ void CodeGenModule::Release() {
                               uint32_t(CLANG_VERSION_MINOR));
     getModule().addModuleFlag(llvm::Module::Warning, "zos_product_patchlevel",
                               uint32_t(CLANG_VERSION_PATCHLEVEL));
-    std::string ProductId;
-#ifdef CLANG_VENDOR
-    ProductId = #CLANG_VENDOR;
-#else
-    ProductId = "clang";
-#endif
+    std::string ProductId = getClangVendor() + "clang";
----------------
DimitryAndric wrote:

Note that this is the way you are supposed to get a "product-id-with-vendor", as the vendor tag itself normally does not contain the word "clang". For example, FreeBSD uses "FreeBSD " (so with a trailing space), and Apple uses "Apple " (also with trailing space). If any space is desired between the vendor tag and the word "clang", it has to be specified in the vendor tag, and not appended here in the string concatenation.

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


More information about the cfe-commits mailing list