francii created this revision. Herald added a project: All. francii requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang.
Throw an error when trying to compile with `-p` or `-pg` on z/OS, as the platform does not support `prof` and `gprof`. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D137756 Files: clang/include/clang/Basic/DiagnosticDriverKinds.td clang/lib/Driver/ToolChains/ZOS.cpp clang/test/Driver/zos-profiling-error.c Index: clang/test/Driver/zos-profiling-error.c =================================================================== --- /dev/null +++ clang/test/Driver/zos-profiling-error.c @@ -0,0 +1,7 @@ +// Check failed cases + +// RUN: not %clang -target s390x-none-zos -p -S %s 2>&1 | FileCheck -check-prefix=FAIL-P-NAME %s +// FAIL-P-NAME: error: the clang compiler does not support the '-p' option on z/OS. + +// RUN: not %clang -target s390x-none-zos -pg -S %s 2>&1 | FileCheck -check-prefix=FAIL-PG-NAME %s +// FAIL-PG-NAME: error: the clang compiler does not support the '-pg' option on z/OS. Index: clang/lib/Driver/ToolChains/ZOS.cpp =================================================================== --- clang/lib/Driver/ToolChains/ZOS.cpp +++ clang/lib/Driver/ToolChains/ZOS.cpp @@ -18,7 +18,12 @@ using namespace clang; ZOS::ZOS(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - : ToolChain(D, Triple, Args) {} + : ToolChain(D, Triple, Args) { + for (Arg *A : Args.filtered(options::OPT_p, options::OPT_pg)) { + auto ArgString = A->getAsString(Args); + this->getDriver().Diag(diag::err_option_unsupported_zos) << ArgString; + } +} ZOS::~ZOS() {} Index: clang/include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticDriverKinds.td +++ clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -237,6 +237,9 @@ def err_arch_unsupported_isa : Error<"architecture '%0' does not support '%1' execution mode">; +def err_option_unsupported_zos: Error< + "the clang compiler does not support the '%0' option on z/OS.">; + def err_drv_I_dash_not_supported : Error< "'%0' not supported, please use -iquote instead">; def err_drv_unknown_argument : Error<"unknown argument: '%0'">;
Index: clang/test/Driver/zos-profiling-error.c =================================================================== --- /dev/null +++ clang/test/Driver/zos-profiling-error.c @@ -0,0 +1,7 @@ +// Check failed cases + +// RUN: not %clang -target s390x-none-zos -p -S %s 2>&1 | FileCheck -check-prefix=FAIL-P-NAME %s +// FAIL-P-NAME: error: the clang compiler does not support the '-p' option on z/OS. + +// RUN: not %clang -target s390x-none-zos -pg -S %s 2>&1 | FileCheck -check-prefix=FAIL-PG-NAME %s +// FAIL-PG-NAME: error: the clang compiler does not support the '-pg' option on z/OS. Index: clang/lib/Driver/ToolChains/ZOS.cpp =================================================================== --- clang/lib/Driver/ToolChains/ZOS.cpp +++ clang/lib/Driver/ToolChains/ZOS.cpp @@ -18,7 +18,12 @@ using namespace clang; ZOS::ZOS(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - : ToolChain(D, Triple, Args) {} + : ToolChain(D, Triple, Args) { + for (Arg *A : Args.filtered(options::OPT_p, options::OPT_pg)) { + auto ArgString = A->getAsString(Args); + this->getDriver().Diag(diag::err_option_unsupported_zos) << ArgString; + } +} ZOS::~ZOS() {} Index: clang/include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticDriverKinds.td +++ clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -237,6 +237,9 @@ def err_arch_unsupported_isa : Error<"architecture '%0' does not support '%1' execution mode">; +def err_option_unsupported_zos: Error< + "the clang compiler does not support the '%0' option on z/OS.">; + def err_drv_I_dash_not_supported : Error< "'%0' not supported, please use -iquote instead">; def err_drv_unknown_argument : Error<"unknown argument: '%0'">;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits