[PATCH] D21031: [OpenCL] Allow -cl-std and other standard -cl- options in driver
Anastasia Stulova via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 22 08:13:07 PDT 2016
Anastasia added inline comments.
================
Comment at: lib/Frontend/CompilerInvocation.cpp:1673
@@ +1672,3 @@
+ // this option was added for compatibility with OpenCL 1.0.
+ if (const Arg *A = Args.getLastArg(OPT_cl_strict_aliasing)) {
+ const int OpenCLVer = Opts.OpenCLVersion;
----------------
Could you check the OpenCL version here instead?
================
Comment at: lib/Frontend/CompilerInvocation.cpp:1675
@@ +1674,3 @@
+ const int OpenCLVer = Opts.OpenCLVersion;
+ std::string VerSpec = llvm::to_string(OpenCLVer / 100) +
+ std::string (".") +
----------------
It seems OK to use Opts.OpenCLVersion directly!
================
Comment at: test/Driver/opencl.cl:1
@@ -1,13 +1,2 @@
-// RUN: %clang -fsyntax-only %s
-// RUN: %clang -fsyntax-only -std=cl %s
-// RUN: %clang -fsyntax-only -std=cl1.1 %s
-// RUN: %clang -fsyntax-only -std=cl1.2 %s
-// RUN: %clang -fsyntax-only -std=cl2.0 %s
-// RUN: %clang -fsyntax-only -std=CL %s
-// RUN: %clang -fsyntax-only -std=CL1.1 %s
-// RUN: %clang -fsyntax-only -std=CL1.2 %s
-// RUN: %clang -fsyntax-only -std=CL2.0 %s
-// RUN: not %clang_cc1 -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
-// RUN: not %clang_cc1 -std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
-// CHECK-C99: error: invalid argument '-std=c99' not allowed with 'OpenCL'
-// CHECK-INVALID: error: invalid value 'invalid' in '-std=invalid'
+// RUN: %clang -S -### %s
+// RUN: %clang -S -### -cl-std=CL %s | FileCheck --check-prefix=CHECK-CL %s
----------------
Since you are not checking anything here, do we even need this RUN line?
================
Comment at: test/Driver/opencl.cl:20
@@ +19,3 @@
+// RUN: not %clang_cc1 -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
+// CHECK-C99: error: invalid argument '-cl-std=c99' not allowed with 'OpenCL'
+// CHECK-INVALID: error: invalid value 'invalid' in '-cl-std=invalid'
----------------
Could you please separate with an empty line here and order the CHECK lines the same way as RUN lines if possible. It will make it more readable then.
Thanks!
http://reviews.llvm.org/D21031
More information about the cfe-commits
mailing list