diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-03 11:54:46 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-03 11:54:46 -0800 |
commit | 5891420e6848e86a069dc6b7b73f175e22388f4a (patch) | |
tree | 99d82aa1d75dbd2abc6df791b87c384c49277431 /clang/lib/Lex/HeaderMap.cpp | |
parent | 0c2f6e36f9b2d26a2665e38a76ae8a95c158c4c7 (diff) | |
download | llvm-5891420e6848e86a069dc6b7b73f175e22388f4a.zip llvm-5891420e6848e86a069dc6b7b73f175e22388f4a.tar.gz llvm-5891420e6848e86a069dc6b7b73f175e22388f4a.tar.bz2 |
[clang] 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 'clang/lib/Lex/HeaderMap.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderMap.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp index 0001fc3..2512552 100644 --- a/clang/lib/Lex/HeaderMap.cpp +++ b/clang/lib/Lex/HeaderMap.cpp @@ -151,7 +151,7 @@ Optional<StringRef> HeaderMapImpl::getString(unsigned StrTabIdx) const { // Check for invalid index. if (StrTabIdx >= FileBuffer->getBufferSize()) - return None; + return std::nullopt; const char *Data = FileBuffer->getBufferStart() + StrTabIdx; unsigned MaxLen = FileBuffer->getBufferSize() - StrTabIdx; @@ -159,7 +159,7 @@ Optional<StringRef> HeaderMapImpl::getString(unsigned StrTabIdx) const { // Check whether the buffer is null-terminated. if (Len == MaxLen && Data[Len - 1]) - return None; + return std::nullopt; return StringRef(Data, Len); } |