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() {}
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() {}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits