forked from OSchip/llvm-project
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 llvm-svn: 222444
This commit is contained in:
parent
55f410bf16
commit
561e0aa180
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue