]> granicus.if.org Git - clang/commitdiff
Extended list of valid frontend options with '-cl-std=CL2.0'.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 20 Nov 2014 19:25:00 +0000 (19:25 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 20 Nov 2014 19:25:00 +0000 (19:25 +0000)
This option sets language mode for the compilation of a source file to be OpenCL v2.0.

Example: clang -cc1 -cl-std=CL2.0 myfile.cl

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222444 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/LangStandards.def
lib/Frontend/CompilerInvocation.cpp
test/Frontend/std.cl [new file with mode: 0644]

index 5bcabaad12a4499c97b0cc4494318b0402579f50..cac9c3c4155f39707f0804f0ccf0779aacbe1115 100644 (file)
@@ -141,6 +141,9 @@ LANGSTANDARD(opencl11, "CL1.1",
 LANGSTANDARD(opencl12, "CL1.2",
              "OpenCL 1.2",
              LineComment | C99 | Digraphs | HexFloat)
+LANGSTANDARD(opencl20, "CL2.0",
+             "OpenCL 2.0",
+             LineComment | C99 | Digraphs | HexFloat)
 
 // CUDA
 LANGSTANDARD(cuda, "cuda",
index a57c8b508e746df5df03c2fdc080dc94d9f17c30..f261c6c73346b78d8113655b402f4056bc38ecdb 100644 (file)
@@ -1172,10 +1172,12 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
   if (LangStd == LangStandard::lang_opencl)
     Opts.OpenCLVersion = 100;
   else if (LangStd == LangStandard::lang_opencl11)
-      Opts.OpenCLVersion = 110;
+    Opts.OpenCLVersion = 110;
   else if (LangStd == LangStandard::lang_opencl12)
     Opts.OpenCLVersion = 120;
-  
+  else if (LangStd == LangStandard::lang_opencl20)
+    Opts.OpenCLVersion = 200;
+
   // OpenCL has some additional defaults.
   if (Opts.OpenCL) {
     Opts.AltiVec = 0;
@@ -1323,6 +1325,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
     .Case("CL", LangStandard::lang_opencl)
     .Case("CL1.1", LangStandard::lang_opencl11)
     .Case("CL1.2", LangStandard::lang_opencl12)
+    .Case("CL2.0", LangStandard::lang_opencl20)
     .Default(LangStandard::lang_unspecified);
     
     if (OpenCLLangStd == LangStandard::lang_unspecified) {
diff --git a/test/Frontend/std.cl b/test/Frontend/std.cl
new file mode 100644 (file)
index 0000000..b811b64
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL
+// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL1.1
+// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL1.2
+// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL2.0
+// RUN: not %clang_cc1 %s -fsyntax-only -cl-std=invalid -DINVALID 2>&1 | FileCheck %s
+
+#ifdef INVALID 
+// CHECK: invalid value 'invalid' in '-cl-std=invalid'
+#endif