[cfe-commits] r152684 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/altivec.cpp
Chad Rosier
mcrosier at apple.com
Tue Mar 13 16:45:51 PDT 2012
Author: mcrosier
Date: Tue Mar 13 18:45:51 2012
New Revision: 152684
URL: http://llvm.org/viewvc/llvm-project?rev=152684&view=rev
Log:
[driver] Clang should report an error for -faltivec on non-ppc.
rdar://10963572
Added:
cfe/trunk/test/Driver/altivec.cpp
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=152684&r1=152683&r2=152684&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 13 18:45:51 2012
@@ -1950,6 +1950,14 @@
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);
Added: cfe/trunk/test/Driver/altivec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/altivec.cpp?rev=152684&view=auto
==============================================================================
--- cfe/trunk/test/Driver/altivec.cpp (added)
+++ cfe/trunk/test/Driver/altivec.cpp Tue Mar 13 18:45:51 2012
@@ -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
More information about the cfe-commits
mailing list