diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-02 20:36:04 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-02 20:36:05 -0800 |
commit | e9e64f7c9e8af778faa62d1b412f190bb3e85f3c (patch) | |
tree | b7f32a0c08dbc857f275e93a005b276bdd294c54 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | e842c06c2d52ae1d60db7ed528ea3f4215a0aad6 (diff) | |
download | llvm-e9e64f7c9e8af778faa62d1b412f190bb3e85f3c.zip llvm-e9e64f7c9e8af778faa62d1b412f190bb3e85f3c.tar.gz llvm-e9e64f7c9e8af778faa62d1b412f190bb3e85f3c.tar.bz2 |
[Bitcode] 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/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 0b6c509..1d5d10a 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -554,7 +554,7 @@ public: Optional<unsigned> getInRangeIndex() const { assert(Opcode == Instruction::GetElementPtr); if (Extra == (unsigned)-1) - return None; + return std::nullopt; return Extra; } @@ -822,7 +822,9 @@ private: Error parseAttrKind(uint64_t Code, Attribute::AttrKind *Kind); Error parseModule( uint64_t ResumeBit, bool ShouldLazyLoadMetadata = false, - DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; }); + DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { + return std::nullopt; + }); Error parseComdatRecord(ArrayRef<uint64_t> Record); Error parseGlobalVarRecord(ArrayRef<uint64_t> Record); @@ -7915,7 +7917,7 @@ Expected<std::unique_ptr<Module>> BitcodeModule::getLazyModule(LLVMContext &Context, bool ShouldLazyLoadMetadata, bool IsImporting) { return getModuleImpl(Context, false, ShouldLazyLoadMetadata, IsImporting, - [](StringRef) { return None; }); + [](StringRef) { return std::nullopt; }); } // Parse the specified bitcode buffer and merge the index into CombinedIndex. |