diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-07-13 21:21:05 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-07-13 21:21:05 +0000 |
commit | 02c3979e226d8d5782e2ea2b6b5d9a1010854181 (patch) | |
tree | d8f09addaa3d2a1b8858ccd54a226e6b6ddceef9 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 640a61cd8bb4f0172bd0ec392d5e0f2e4d65c1bf (diff) | |
download | bcm5719-llvm-02c3979e226d8d5782e2ea2b6b5d9a1010854181.tar.gz bcm5719-llvm-02c3979e226d8d5782e2ea2b6b5d9a1010854181.zip |
[OpenCL] Fixes failures in test/Driver/opencl.cl.
Also fixes strict-aliasing option to only be allowed when OpenCL Version 1.0. Added testcase in test/Frontend/opencl-blocks.cl.
Patch by Aaron En Ye Shi.
Differential Revision: http://reviews.llvm.org/D22170
llvm-svn: 275318
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 7bc91ad79bf..5910664e6a6 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1674,23 +1674,23 @@ 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); CompilerInvocation::setLangDefaults(Opts, IK, T, PPOpts, LangStd); + // -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 (Args.getLastArg(OPT_cl_strict_aliasing) + && 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 << Args.getLastArg(OPT_cl_strict_aliasing)->getAsString(Args); + } + // We abuse '-f[no-]gnu-keywords' to force overriding all GNU-extension // keywords. This behavior is provided by GCC's poorly named '-fasm' flag, // while a subset (the non-C++ GNU keywords) is provided by GCC's |