14 #ifndef LLVM_CLANG_BASIC_OPENCLOPTIONS_H 15 #define LLVM_CLANG_BASIC_OPENCLOPTIONS_H 18 #include "llvm/ADT/StringMap.h" 30 Info(
bool S =
false,
bool E =
false,
unsigned A = 100,
unsigned C = ~0U)
31 :Supported(S), Enabled(E), Avail(A), Core(
C){}
33 llvm::StringMap<Info> OptMap;
36 return OptMap.find(Ext) != OptMap.end();
40 return OptMap.find(Ext)->second.Enabled;
47 auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
48 auto I = OptMap.find(Ext)->getValue();
49 return I.Supported && I.Avail <= CLVer;
56 auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
57 auto I = OptMap.find(Ext)->getValue();
58 return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
65 auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
66 auto I = OptMap.find(Ext)->getValue();
67 return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
70 void enable(llvm::StringRef Ext,
bool V =
true) {
71 OptMap[Ext].Enabled =
V;
78 void support(llvm::StringRef Ext,
bool V =
true) {
79 assert(!Ext.empty() &&
"Extension is empty.");
84 Ext = Ext.drop_front();
88 Ext = Ext.drop_front();
92 if (Ext.equals(
"all")) {
96 OptMap[Ext].Supported =
V;
100 #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \ 101 OptMap[#Ext].Avail = AvailVer; \ 102 OptMap[#Ext].Core = CoreVer; 103 #include "clang/Basic/OpenCLExtensions.def" 107 for (
auto &I:Opts.OptMap)
108 if (I.second.Supported)
109 OptMap[I.getKey()].Supported =
true;
113 OptMap = Opts.OptMap;
118 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
119 E = OptMap.end(); I != E; ++I)
120 I->second.Supported = On;
124 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
125 E = OptMap.end(); I != E; ++I)
126 I->second.Enabled =
false;
130 for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
133 I->second.Enabled =
true;
void support(llvm::StringRef Ext, bool V=true)
Enable or disable support for OpenCL extensions.
OpenCL supported extensions and optional core features.
void copy(const OpenCLOptions &Opts)
void enableSupportedCore(LangOptions LO)
void supportAll(bool On=true)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const
bool isEnabled(llvm::StringRef Ext) const
Defines the clang::LangOptions interface.
void enable(llvm::StringRef Ext, bool V=true)
bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const
bool isKnown(llvm::StringRef Ext) const
void addSupport(const OpenCLOptions &Opts)
bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const
Dataflow Directional Tag Classes.
Reads an AST files chain containing the contents of a translation unit.
Writes an AST file containing the contents of a translation unit.