[cfe-commits] r120882 - in /cfe/trunk: include/clang/Driver/CC1Options.td lib/Frontend/CompilerInvocation.cpp

Peter Collingbourne peter at pcc.me.uk
Fri Dec 3 17:51:40 PST 2010


Author: pcc
Date: Fri Dec  3 19:51:40 2010
New Revision: 120882

URL: http://llvm.org/viewvc/llvm-project?rev=120882&view=rev
Log:
Implement -cl-std=

Modified:
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=120882&r1=120881&r2=120882&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Dec  3 19:51:40 2010
@@ -609,3 +609,5 @@
   HelpText<"OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__">;
 def cl_mad_enable : Flag<"-cl-mad-enable">,
   HelpText<"OpenCL only. Enable less precise MAD instructions to be generated.">;
+def cl_std_EQ : Joined<"-cl-std=">,
+  HelpText<"OpenCL language standard to compile for">;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=120882&r1=120881&r2=120882&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Dec  3 19:51:40 2010
@@ -1322,6 +1322,13 @@
         << A->getAsString(Args) << A->getValue(Args);
   }
 
+  if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
+    if (strcmp(A->getValue(Args), "CL1.1") != 0) {
+      Diags.Report(diag::err_drv_invalid_value)
+        << A->getAsString(Args) << A->getValue(Args);
+    }
+  }
+
   CompilerInvocation::setLangDefaults(Opts, IK, LangStd);
 
   // We abuse '-f[no-]gnu-keywords' to force overriding all GNU-extension





More information about the cfe-commits mailing list