15 #ifndef LLVM_CLANG_BASIC_OPENCLOPTIONS_H 16 #define LLVM_CLANG_BASIC_OPENCLOPTIONS_H 19 #include "llvm/ADT/StringMap.h" 31 Info(
bool S =
false,
bool E =
false,
unsigned A = 100,
unsigned C = ~0U)
32 :Supported(S), Enabled(E), Avail(A), Core(
C){}
34 llvm::StringMap<Info> OptMap;
37 return OptMap.find(Ext) != OptMap.end();
41 return OptMap.find(Ext)->second.Enabled;
48 auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
49 auto I = OptMap.find(Ext)->getValue();
50 return I.Supported && I.Avail <= CLVer;
57 auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
58 auto I = OptMap.find(Ext)->getValue();
59 return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
66 auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
67 auto I = OptMap.find(Ext)->getValue();
68 return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
71 void enable(llvm::StringRef Ext,
bool V =
true) {
72 OptMap[Ext].Enabled = V;
79 void support(llvm::StringRef Ext,
bool V =
true) {
80 assert(!Ext.empty() &&
"Extension is empty.");
85 Ext = Ext.drop_front();
89 Ext = Ext.drop_front();
93 if (Ext.equals(
"all")) {
97 OptMap[Ext].Supported = V;
101 #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \ 102 OptMap[#Ext].Avail = AvailVer; \ 103 OptMap[#Ext].Core = CoreVer; 104 #include "clang/Basic/OpenCLExtensions.def" 108 for (
auto &I:Opts.OptMap)
109 if (I.second.Supported)
110 OptMap[I.getKey()].Supported =
true;
114 OptMap = Opts.OptMap;
119 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
120 E = OptMap.end(); I != E; ++I)
121 I->second.Supported = On;
125 for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
126 E = OptMap.end(); I != E; ++I)
127 I->second.Enabled =
false;
131 for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
134 I->second.Enabled =
true;
bool isSupportedExtension(llvm::StringRef Ext, LangOptions LO) const
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)
bool isSupportedCore(llvm::StringRef Ext, LangOptions LO) const
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 isEnabled(llvm::StringRef Ext) const
Defines the clang::LangOptions interface.
void enable(llvm::StringRef Ext, bool V=true)
bool isKnown(llvm::StringRef Ext) const
void addSupport(const OpenCLOptions &Opts)
bool isSupported(llvm::StringRef Ext, 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.