[clang] [llvm] [SystemZ][z/OS] This change adds support for the PPA2 section in zOS (PR #68926)

Sean Perry via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 22 13:48:55 PST 2023


================
@@ -976,6 +976,46 @@ void CodeGenModule::Release() {
       Context.getTypeSizeInChars(Context.getWideCharType()).getQuantity();
   getModule().addModuleFlag(llvm::Module::Error, "wchar_size", WCharWidth);
 
+  if (getTriple().isOSzOS()) {
+    getModule().addModuleFlag(llvm::Module::Warning,
+                              "zos_product_major_version",
+                              uint32_t(CLANG_VERSION_MAJOR));
+    getModule().addModuleFlag(llvm::Module::Warning,
+                              "zos_product_minor_version",
+                              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
+    // Remove - from Product Id, which makes it consistent with legacy.
+    std::size_t DashFound = ProductId.find("-");
+    if (DashFound != std::string::npos)
+      ProductId.erase(ProductId.begin() + DashFound);
----------------
perry-ca wrote:

The proper product id contains the dash.  The only place we don't include the dash is in the PPA2 timestamp string.  This is to be compat with XL.   We would like all uses of CLANG_VENDOR to use the proper product id (except for this one use in PPA2).

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


More information about the cfe-commits mailing list