From aadaaface2ec96ee30d92bf46faa41dd9e68b64d Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 2 Dec 2022 21:11:44 -0800 Subject: [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 --- llvm/lib/Support/UnicodeNameToCodepoint.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Support/UnicodeNameToCodepoint.cpp') diff --git a/llvm/lib/Support/UnicodeNameToCodepoint.cpp b/llvm/lib/Support/UnicodeNameToCodepoint.cpp index cc1463d..5fb6125 100644 --- a/llvm/lib/Support/UnicodeNameToCodepoint.cpp +++ b/llvm/lib/Support/UnicodeNameToCodepoint.cpp @@ -294,7 +294,7 @@ nameToHangulCodePoint(StringRef Name, bool Strict, BufferType &Buffer) { bool DoesStartWith = startsWith(Name, "HANGUL SYLLABLE ", Strict, Consummed, NameStart, NeedleStart); if (!DoesStartWith) - return None; + return std::nullopt; Name = Name.substr(Consummed); int L = -1, V = -1, T = -1; Name = Name.substr(findSyllable(Name, Strict, NameStart, L, 0)); @@ -314,7 +314,7 @@ nameToHangulCodePoint(StringRef Name, bool Strict, BufferType &Buffer) { std::uint32_t(T); } // Otherwise, it's an illegal syllable name. - return None; + return std::nullopt; } struct GeneratedNamesData { @@ -367,13 +367,13 @@ nameToGeneratedCodePoint(StringRef Name, bool Strict, BufferType &Buffer) { } return V; } - return None; + return std::nullopt; } static llvm::Optional nameToCodepoint(StringRef Name, bool Strict, BufferType &Buffer) { if (Name.empty()) - return None; + return std::nullopt; llvm::Optional Res = nameToHangulCodePoint(Name, Strict, Buffer); if (!Res) @@ -397,7 +397,7 @@ static llvm::Optional nameToCodepoint(StringRef Name, bool Strict, } return Value; } - return None; + return std::nullopt; } llvm::Optional nameToCodepointStrict(StringRef Name) { @@ -412,7 +412,7 @@ nameToCodepointLooseMatching(StringRef Name) { BufferType Buffer; auto Opt = nameToCodepoint(Name, false, Buffer); if (!Opt) - return None; + return std::nullopt; return LooseMatchingResult{*Opt, Buffer}; } -- cgit v1.1