diff options
author | Yusra Syeda <99052248+ysyeda@users.noreply.github.com> | 2023-11-27 16:30:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-27 16:30:12 -0500 |
commit | 9a38a72f1d482ce3e1ecd30550d78484debd69ae (patch) | |
tree | 6384c6a0fdd7130bb2e2e1ca5fa40e2b44698a26 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | fc6b72523f3d73b921690a713e97a433c96066c6 (diff) | |
download | llvm-9a38a72f1d482ce3e1ecd30550d78484debd69ae.zip llvm-9a38a72f1d482ce3e1ecd30550d78484debd69ae.tar.gz llvm-9a38a72f1d482ce3e1ecd30550d78484debd69ae.tar.bz2 |
[SystemZ][z/OS] This change adds support for the PPA2 section in zOS (#68926)
This PR adds support for the PPA2 fields.
---------
Co-authored-by: Yusra Syeda <yusra.syeda@ibm.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 7cdf50a..41ff4a9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -985,6 +985,41 @@ 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 + getModule().addModuleFlag(llvm::Module::Error, "zos_product_id", + llvm::MDString::get(VMContext, ProductId)); + + // Record the language because we need it for the PPA2. + StringRef lang_str = languageToString( + LangStandard::getLangStandardForKind(LangOpts.LangStd).Language); + getModule().addModuleFlag(llvm::Module::Error, "zos_cu_language", + llvm::MDString::get(VMContext, lang_str)); + + time_t TT = PreprocessorOpts.SourceDateEpoch + ? *PreprocessorOpts.SourceDateEpoch + : std::time(nullptr); + getModule().addModuleFlag(llvm::Module::Max, "zos_translation_time", + static_cast<uint64_t>(TT)); + + // Multiple modes will be supported here. + getModule().addModuleFlag(llvm::Module::Error, "zos_le_char_mode", + llvm::MDString::get(VMContext, "ascii")); + } + llvm::Triple::ArchType Arch = Context.getTargetInfo().getTriple().getArch(); if ( Arch == llvm::Triple::arm || Arch == llvm::Triple::armeb |