15 #ifndef LLVM_CLANG_BASIC_OPENCLOPTIONS_H 16 #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;
46 auto I = OptMap.find(Ext)->getValue();
47 return I.Supported && I.Avail <= CLVer;
53 auto I = OptMap.find(Ext)->getValue();
54 return I.Supported && I.Avail <= CLVer &&
55 I.Core != ~0U && CLVer >= I.Core;
61 auto I = OptMap.find(Ext)->getValue();
62 return I.Supported && I.Avail <= CLVer &&
63 (I.Core == ~0U || CLVer < I.Core);
66 void enable(llvm::StringRef Ext,
bool V =
true) {
67 OptMap[Ext].Enabled = V;
74 void support(llvm::StringRef Ext,
bool V =
true) {
75 assert(!Ext.empty() &&
"Extension is empty.");
80 Ext = Ext.drop_front();
84 Ext = Ext.drop_front();
88 if (Ext.equals(
"all")) {
92 OptMap[Ext].Supported = V;
96 #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \ 97 OptMap[#Ext].Avail = AvailVer; \ 98 OptMap[#Ext].Core = CoreVer; 99 #include "clang/Basic/OpenCLExtensions.def" 103 for (
auto &I:Opts.OptMap)
104 if (I.second.Supported)
105 OptMap[I.getKey()].Supported =
true;
109 OptMap = Opts.OptMap;
114 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
115 E = OptMap.end(); I != E; ++I)
116 I->second.Supported = On;
120 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
121 E = OptMap.end(); I != E; ++I)
122 I->second.Enabled =
false;
126 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
127 E = OptMap.end(); I != E; ++I)
129 I->second.Enabled =
true;
void support(llvm::StringRef Ext, bool V=true)
Enable or disable support for OpenCL extensions.
bool isSupportedCore(llvm::StringRef Ext, unsigned CLVer) const
OpenCL supported extensions and optional core features.
void copy(const OpenCLOptions &Opts)
void enableSupportedCore(unsigned CLVer)
void supportAll(bool On=true)
bool isEnabled(llvm::StringRef Ext) const
bool isSupportedExtension(llvm::StringRef Ext, unsigned CLVer) const
void enable(llvm::StringRef Ext, bool V=true)
bool isSupported(llvm::StringRef Ext, unsigned CLVer) const
bool isKnown(llvm::StringRef Ext) const
void addSupport(const OpenCLOptions &Opts)
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.