From b5f176e9bdbd340017e419075e382dc3d4b4b93f Mon Sep 17 00:00:00 2001 From: Yaxun Liu Date: Wed, 29 Jun 2016 19:39:32 +0000 Subject: [OpenCL] Allow -cl-std and other standard -cl- options in driver Allow -cl-std and other standard -cl- options from cc1 to driver. Added a test for the options moved. Patch by Aaron En Ye Shi. Differential Revision: http://reviews.llvm.org/D21031 llvm-svn: 274150 --- clang/lib/Frontend/CompilerInvocation.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 0fc6e3a..1abe4ff 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -41,6 +41,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Support/ScopedPrinter.h" #include #include #include @@ -1671,6 +1672,18 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, LangStd = OpenCLLangStd; } + // -cl-strict-aliasing needs to emit diagnostic in the case where CL > 1.0. + // This option should be deprecated for CL > 1.0 because + // this option was added for compatibility with OpenCL 1.0. + if (const Arg *A = Args.getLastArg(OPT_cl_strict_aliasing)) + if (Opts.OpenCLVersion > 100) { + std::string VerSpec = llvm::to_string(Opts.OpenCLVersion / 100) + + std::string (".") + + llvm::to_string((Opts.OpenCLVersion % 100) / 10); + Diags.Report(diag::warn_option_invalid_ocl_version) + << VerSpec << A->getAsString(Args); + } + Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header); llvm::Triple T(TargetOpts.Triple); -- cgit v1.1