[PATCH] D137756: [z/OS][p][pg] Throw Error When Using -p or -pg on z/OS
Michael Francis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 9 18:07:27 PST 2022
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'">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137756.474406.patch
Type: text/x-patch
Size: 1816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221110/5f08d994/attachment.bin>
More information about the cfe-commits
mailing list