From: Tanya Lattner Date: Mon, 18 Jun 2012 22:55:02 +0000 (+0000) Subject: Add language std for OpenCL 1.1 and 1.2. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4205e12cede5db17f47b31471852bb4a1f27533;p=clang Add language std for OpenCL 1.1 and 1.2. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158686 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def index d2ce7c0df6..200236a133 100644 --- a/include/clang/Basic/LangOptions.def +++ b/include/clang/Basic/LangOptions.def @@ -112,6 +112,7 @@ LANGOPT(ShortWChar , 1, 0, "unsigned short wchar_t") LANGOPT(ShortEnums , 1, 0, "short enum types") LANGOPT(OpenCL , 1, 0, "OpenCL") +LANGOPT(OpenCLVersion , 32, 0, "OpenCL version") LANGOPT(CUDA , 1, 0, "CUDA") LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators") diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index 4bcff4a92b..a604d4bff6 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -111,6 +111,12 @@ LANGSTANDARD(gnucxx11, "gnu++11", LANGSTANDARD(opencl, "cl", "OpenCL 1.0", BCPLComment | C99 | Digraphs | HexFloat) +LANGSTANDARD(opencl11, "CL1.1", + "OpenCL 1.1", + BCPLComment | C99 | Digraphs | HexFloat) +LANGSTANDARD(opencl12, "CL1.2", + "OpenCL 1.2", + BCPLComment | C99 | Digraphs | HexFloat) // CUDA LANGSTANDARD(cuda, "cuda", diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 2b4d5e7894..fcc260f013 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1760,9 +1760,22 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, Opts.HexFloats = Std.hasHexFloats(); Opts.ImplicitInt = Std.hasImplicitInt(); - // OpenCL has some additional defaults. + // Set OpenCL Version. if (LangStd == LangStandard::lang_opencl) { Opts.OpenCL = 1; + Opts.OpenCLVersion = 100; + } + else if (LangStd == LangStandard::lang_opencl11) { + Opts.OpenCL = 1; + Opts.OpenCLVersion = 110; + } + else if (LangStd == LangStandard::lang_opencl12) { + Opts.OpenCL = 1; + Opts.OpenCLVersion = 120; + } + + // OpenCL has some additional defaults. + if (Opts.OpenCL) { Opts.AltiVec = 0; Opts.CXXOperatorNames = 1; Opts.LaxVectorConversions = 0;