diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-02 20:05:20 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-02 20:05:20 -0800 |
commit | e842c06c2d52ae1d60db7ed528ea3f4215a0aad6 (patch) | |
tree | 2fa4d17e05b9dec6d22fddb83293ebb43b0dfc7d /llvm/lib/IR/Module.cpp | |
parent | 19aff0f37dd68ee51e78b764c0ce629ae73d1eef (diff) | |
download | llvm-e842c06c2d52ae1d60db7ed528ea3f4215a0aad6.zip llvm-e842c06c2d52ae1d60db7ed528ea3f4215a0aad6.tar.gz llvm-e842c06c2d52ae1d60db7ed528ea3f4215a0aad6.tar.bz2 |
[IR] 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/IR/Module.cpp')
-rw-r--r-- | llvm/lib/IR/Module.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index 33d71fb..a9e80b3d 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -620,7 +620,7 @@ Optional<CodeModel::Model> Module::getCodeModel() const { auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("Code Model")); if (!Val) - return None; + return std::nullopt; return static_cast<CodeModel::Model>( cast<ConstantInt>(Val->getValue())->getZExtValue()); @@ -778,7 +778,7 @@ static VersionTuple getSDKVersionMD(Metadata *MD) { return {}; auto getVersionComponent = [&](unsigned Index) -> std::optional<unsigned> { if (Index >= Arr->getNumElements()) - return None; + return std::nullopt; return (unsigned)Arr->getElementAsInteger(Index); }; auto Major = getVersionComponent(0); |