[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 21:51:41 PST 2022


francii updated this revision to Diff 474440.
francii added a comment.

Use existing error


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137756/new/

https://reviews.llvm.org/D137756

Files:
  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: unsupported option '-p' for target 's390x-none-zos'
+
+// RUN: not %clang -target s390x-none-zos -pg -S %s 2>&1 | FileCheck -check-prefix=FAIL-PG-NAME %s
+// FAIL-PG-NAME: rror: unsupported option '-pg' for target 's390x-none-zos'
Index: clang/lib/Driver/ToolChains/ZOS.cpp
===================================================================
--- clang/lib/Driver/ToolChains/ZOS.cpp
+++ clang/lib/Driver/ToolChains/ZOS.cpp
@@ -18,7 +18,13 @@
 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_drv_unsupported_opt_for_target)
+        << ArgString << Triple.getTriple();
+  }
+}
 
 ZOS::~ZOS() {}
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137756.474440.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221110/299e1d0e/attachment.bin>


More information about the cfe-commits mailing list