summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/TargetInfo.h
diff options
context:
space:
mode:
authorAlexey Bader <aleksey.bader@mail.ru>2016-11-01 15:50:52 +0000
committerAlexey Bader <aleksey.bader@mail.ru>2016-11-01 15:50:52 +0000
commit63cbcdadcc74a3a6e0ff9f76028758ce97741203 (patch)
treed554412ac39a4551ca9cd3b2b8260d1dc2f97389 /include/clang/Basic/TargetInfo.h
parent1cd2ec853d7d1b67c182989921a27fc875e36ffb (diff)
[OpenCL] Override supported OpenCL extensions with -cl-ext option
Summary: This patch adds a command line option '-cl-ext' to control a set of supported OpenCL extensions. Option accepts a comma-separated list of extensions prefixed with '+' or '-'. It can be used together with a target triple to override support for some extensions: // spir target supports all extensions, but we want to disable fp64 clang -cc1 -triple spir-unknown-unknown -cl-ext=-cl_khr_fp64 Special 'all' extension allows to enable or disable all possible extensions: // only fp64 will be supported clang -cc1 -triple spir-unknown-unknown -cl-ext=-all,+cl_khr_fp64 Patch by asavonic (Andrew Savonichev). Reviewers: joey, yaxunl Subscribers: yaxunl, bader, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D23712 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetInfo.h')
-rw-r--r--include/clang/Basic/TargetInfo.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index dbdbff8473..d231882e97 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -995,6 +995,13 @@ public:
/// \brief Set supported OpenCL extensions and optional core features.
virtual void setSupportedOpenCLOpts() {}
+ /// \brief Set supported OpenCL extensions as written on command line
+ virtual void setOpenCLExtensionOpts() {
+ for (const auto &Ext : getTargetOpts().OpenCLExtensionsAsWritten) {
+ getTargetOpts().SupportedOpenCLOptions.set(Ext);
+ }
+ }
+
/// \brief Get supported OpenCL extensions and optional core features.
OpenCLOptions &getSupportedOpenCLOpts() {
return getTargetOpts().SupportedOpenCLOptions;