summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2016-06-29 19:39:32 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2016-06-29 19:39:32 +0000
commitb5f176e9bdbd340017e419075e382dc3d4b4b93f (patch)
treea8da9bc2993b423046eec75eba01bcfb1ddc393d /clang/lib/Frontend/CompilerInvocation.cpp
parentfe813634c1299a674d4f98d8861996c0f292d0db (diff)
downloadbcm5719-llvm-b5f176e9bdbd340017e419075e382dc3d4b4b93f.tar.gz
bcm5719-llvm-b5f176e9bdbd340017e419075e382dc3d4b4b93f.zip
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 0fc6e3a9c34..1abe4ff863d 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 <atomic>
#include <memory>
#include <sys/stat.h>
@@ -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);
OpenPOWER on IntegriCloud