diff --git a/include/clang/Basic/OpenCLOptions.h b/include/clang/Basic/OpenCLOptions.h index 9fb4dbb7ba764ffdcdfbede0cbace3e670c8087f..a51494fa2e3276a7f5bbda77808a96e9589515a0 100644 --- a/include/clang/Basic/OpenCLOptions.h +++ b/include/clang/Basic/OpenCLOptions.h @@ -32,24 +32,24 @@ class OpenCLOptions { }; llvm::StringMap<Info> OptMap; public: - bool isKnown(StringRef Ext) const { + bool isKnown(llvm::StringRef Ext) const { return OptMap.find(Ext) != OptMap.end(); } - bool isEnabled(StringRef Ext) const { + bool isEnabled(llvm::StringRef Ext) const { return OptMap.find(Ext)->second.Enabled; } // Is supported as either an extension or an (optional) core feature for // OpenCL version \p CLVer. - bool isSupported(StringRef Ext, unsigned CLVer) const { + bool isSupported(llvm::StringRef Ext, unsigned CLVer) const { auto I = OptMap.find(Ext)->getValue(); return I.Supported && I.Avail <= CLVer; } // Is supported (optional) OpenCL core features for OpenCL version \p CLVer. // For supported extension, return false. - bool isSupportedCore(StringRef Ext, unsigned CLVer) const { + bool isSupportedCore(llvm::StringRef Ext, unsigned CLVer) const { auto I = OptMap.find(Ext)->getValue(); return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core; @@ -57,13 +57,13 @@ public: // Is supported OpenCL extension for OpenCL version \p CLVer. // For supported (optional) core feature, return false. - bool isSupportedExtension(StringRef Ext, unsigned CLVer) const { + bool isSupportedExtension(llvm::StringRef Ext, unsigned CLVer) const { auto I = OptMap.find(Ext)->getValue(); return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core); } - void enable(StringRef Ext, bool V = true) { + void enable(llvm::StringRef Ext, bool V = true) { OptMap[Ext].Enabled = V; } @@ -71,7 +71,7 @@ public: /// \param Ext name of the extension optionally prefixed with /// '+' or '-' /// \param Enable used when \p Ext is not prefixed by '+' or '-' - void support(StringRef Ext, bool V = true) { + void support(llvm::StringRef Ext, bool V = true) { assert(!Ext.empty() && "Extension is empty."); switch (Ext[0]) { diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index d6324b41d6c25e9a3fc24650f06f6e5a4f53b7de..066261c0215bff77d4c655ba15db96cdf5972a4b 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -3167,8 +3167,8 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { for (unsigned I = 0, E = Record.size(); I != E; ) { auto Name = ReadString(Record, I); auto &Opt = OpenCLExtensions.OptMap[Name]; - Opt.Supported = Record[I++]; - Opt.Enabled = Record[I++]; + Opt.Supported = Record[I++] != 0; + Opt.Enabled = Record[I++] != 0; Opt.Avail = Record[I++]; Opt.Core = Record[I++]; } diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 493941a3eff35112c0ae495e3175898b24427269..6d79ea53b659ee7d3f541c648ba221768847d86c 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -3944,8 +3944,8 @@ void ASTWriter::WriteOpenCLExtensions(Sema &SemaRef) { for (const auto &I:Opts.OptMap) { AddString(I.getKey(), Record); auto V = I.getValue(); - Record.push_back(V.Supported); - Record.push_back(V.Enabled); + Record.push_back(V.Supported ? 1 : 0); + Record.push_back(V.Enabled ? 1 : 0); Record.push_back(V.Avail); Record.push_back(V.Core); }