diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-02 21:11:44 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-02 21:11:44 -0800 |
commit | aadaaface2ec96ee30d92bf46faa41dd9e68b64d (patch) | |
tree | e8da5e8b9e241f764c8fcd8d047b1a3b4f22ce3e /llvm/lib/Bitstream/Reader/BitstreamReader.cpp | |
parent | ed88e60b373383322c4b7465d43dc6c06092facb (diff) | |
download | llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.zip llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.gz llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.bz2 |
[llvm] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'llvm/lib/Bitstream/Reader/BitstreamReader.cpp')
-rw-r--r-- | llvm/lib/Bitstream/Reader/BitstreamReader.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp index c297e16..a3e37c6 100644 --- a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp +++ b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp @@ -438,7 +438,7 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) { switch (Entry.Kind) { case llvm::BitstreamEntry::SubBlock: // Handled for us already. case llvm::BitstreamEntry::Error: - return None; + return std::nullopt; case llvm::BitstreamEntry::EndBlock: return std::move(NewBlockInfo); case llvm::BitstreamEntry::Record: @@ -448,7 +448,8 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) { // Read abbrev records, associate them with CurBID. if (Entry.ID == bitc::DEFINE_ABBREV) { - if (!CurBlockInfo) return None; + if (!CurBlockInfo) + return std::nullopt; if (Error Err = ReadAbbrevRecord()) return std::move(Err); @@ -469,24 +470,25 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) { break; // Default behavior, ignore unknown content. case bitc::BLOCKINFO_CODE_SETBID: if (Record.size() < 1) - return None; + return std::nullopt; CurBlockInfo = &NewBlockInfo.getOrCreateBlockInfo((unsigned)Record[0]); break; case bitc::BLOCKINFO_CODE_BLOCKNAME: { if (!CurBlockInfo) - return None; + return std::nullopt; if (!ReadBlockInfoNames) break; // Ignore name. CurBlockInfo->Name = std::string(Record.begin(), Record.end()); break; } case bitc::BLOCKINFO_CODE_SETRECORDNAME: { - if (!CurBlockInfo) return None; - if (!ReadBlockInfoNames) - break; // Ignore name. - CurBlockInfo->RecordNames.emplace_back( - (unsigned)Record[0], std::string(Record.begin() + 1, Record.end())); - break; + if (!CurBlockInfo) + return std::nullopt; + if (!ReadBlockInfoNames) + break; // Ignore name. + CurBlockInfo->RecordNames.emplace_back( + (unsigned)Record[0], std::string(Record.begin() + 1, Record.end())); + break; } } } |