]> granicus.if.org Git - clang/commitdiff
Implement -cl-std=
authorPeter Collingbourne <peter@pcc.me.uk>
Sat, 4 Dec 2010 01:51:40 +0000 (01:51 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Sat, 4 Dec 2010 01:51:40 +0000 (01:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120882 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1Options.td
lib/Frontend/CompilerInvocation.cpp

index f34a4841f865a302b404241640ba745c4eef3e3e..28a31cacab4fe7551120acd9fe9d206d299d7b6d 100644 (file)
@@ -609,3 +609,5 @@ def cl_fast_relaxed_math : Flag<"-cl-fast-relaxed-math">,
   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">;
index f7656425cc621fa08bde38b861e6cd4658a69f19..7dbc8f23203ec2b5ce92a36272f0a053bce63532 100644 (file)
@@ -1322,6 +1322,13 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
         << 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