]> granicus.if.org Git - clang/commitdiff
Add language std for OpenCL 1.1 and 1.2.
authorTanya Lattner <tonic@nondot.org>
Mon, 18 Jun 2012 22:55:02 +0000 (22:55 +0000)
committerTanya Lattner <tonic@nondot.org>
Mon, 18 Jun 2012 22:55:02 +0000 (22:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158686 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.def
include/clang/Frontend/LangStandards.def
lib/Frontend/CompilerInvocation.cpp

index d2ce7c0df63e783879ae300833db74e331d43050..200236a1338f74c16fb5571347ed066fbf507aa3 100644 (file)
@@ -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")
index 4bcff4a92b50b845329bc2be3898e07869257017..a604d4bff658c05a2281c97e98480d988f53330c 100644 (file)
@@ -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",
index 2b4d5e7894b37f1a521fde4eaa8051c710f4a8a8..fcc260f0138b42339870ece10f02aa0ac1d84655 100644 (file)
@@ -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;