r222444 - Extended list of valid frontend options with '-cl-std=CL2.0'.
Anastasia Stulova
anastasia.stulova at arm.com
Thu Nov 20 11:25:01 PST 2014
Author: stulova
Date: Thu Nov 20 13:25:00 2014
New Revision: 222444
URL: http://llvm.org/viewvc/llvm-project?rev=222444&view=rev
Log:
Extended list of valid frontend options with '-cl-std=CL2.0'.
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
Added:
cfe/trunk/test/Frontend/std.cl
Modified:
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=222444&r1=222443&r2=222444&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Thu Nov 20 13:25:00 2014
@@ -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",
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=222444&r1=222443&r2=222444&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Nov 20 13:25:00 2014
@@ -1172,10 +1172,12 @@ void CompilerInvocation::setLangDefaults
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 &O
.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) {
Added: cfe/trunk/test/Frontend/std.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/std.cl?rev=222444&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/std.cl (added)
+++ cfe/trunk/test/Frontend/std.cl Thu Nov 20 13:25:00 2014
@@ -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
More information about the cfe-commits
mailing list