aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-03-13 23:45:51 +0000
committerChad Rosier <mcrosier@apple.com>2012-03-13 23:45:51 +0000
commit4574c3d75edb0a496d36246b760094f3acf1ba27 (patch)
tree1d0ae28869c571f27033822d23f4f8730015493c
parent3b10cfe6b804cef041ddf85854d2d536f7a82cb6 (diff)
[driver] Clang should report an error for -faltivec on non-ppc.
rdar://10963572 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152684 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/Tools.cpp8
-rw-r--r--test/Driver/altivec.cpp12
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 4c05424192..780016a8b8 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1950,6 +1950,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fno_limit_debug_info);
Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
Args.AddLastArg(CmdArgs, options::OPT_faltivec);
+
+ // Report and error for -faltivec on anything other then PowerPC.
+ if (const Arg *A = Args.getLastArg(options::OPT_faltivec))
+ if (!(getToolChain().getTriple().getArch() == llvm::Triple::ppc ||
+ getToolChain().getTriple().getArch() == llvm::Triple::ppc64))
+ D.Diag(diag::err_drv_argument_only_allowed_with)
+ << A->getAsString(Args) << "ppc/ppc64";
+
if (getToolChain().SupportsProfiling())
Args.AddLastArg(CmdArgs, options::OPT_pg);
diff --git a/test/Driver/altivec.cpp b/test/Driver/altivec.cpp
new file mode 100644
index 0000000000..408c52d5b7
--- /dev/null
+++ b/test/Driver/altivec.cpp
@@ -0,0 +1,12 @@
+// Check that we error when -faltivec is specified on a non-ppc platforms.
+
+// RUN: %clang -arch ppc -faltivec -fsyntax-only %s
+// RUN: %clang -arch ppc64 -faltivec -fsyntax-only %s
+
+// RUN: not %clang -arch i386 -faltivec -fsyntax-only %s
+// RUN: not %clang -arch x86_64 -faltivec -fsyntax-only %s
+// RUN: not %clang -arch armv6 -faltivec -fsyntax-only %s
+// RUN: not %clang -arch armv7 -faltivec -fsyntax-only %s
+// RUN: not %clang -arch mips -faltivec -fsyntax-only %s
+// RUN: not %clang -arch mips64 -faltivec -fsyntax-only %s
+// RUN: not %clang -arch sparc -faltivec -fsyntax-only %s