diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/Support/JSON.cpp | |
parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) |
Diffstat (limited to 'llvm/lib/Support/JSON.cpp')
-rw-r--r-- | llvm/lib/Support/JSON.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/llvm/lib/Support/JSON.cpp b/llvm/lib/Support/JSON.cpp index b87e39f0a963..0e7f7bf1d999 100644 --- a/llvm/lib/Support/JSON.cpp +++ b/llvm/lib/Support/JSON.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/NativeFormatting.h" #include <cctype> +#include <optional> namespace llvm { namespace json { @@ -36,30 +37,30 @@ const Value *Object::get(StringRef K) const { return nullptr; return &I->second; } -llvm::Optional<std::nullptr_t> Object::getNull(StringRef K) const { +std::optional<std::nullptr_t> Object::getNull(StringRef K) const { if (auto *V = get(K)) return V->getAsNull(); - return llvm::None; + return std::nullopt; } -llvm::Optional<bool> Object::getBoolean(StringRef K) const { +std::optional<bool> Object::getBoolean(StringRef K) const { if (auto *V = get(K)) return V->getAsBoolean(); - return llvm::None; + return std::nullopt; } -llvm::Optional<double> Object::getNumber(StringRef K) const { +std::optional<double> Object::getNumber(StringRef K) const { if (auto *V = get(K)) return V->getAsNumber(); - return llvm::None; + return std::nullopt; } -llvm::Optional<int64_t> Object::getInteger(StringRef K) const { +std::optional<int64_t> Object::getInteger(StringRef K) const { if (auto *V = get(K)) return V->getAsInteger(); - return llvm::None; + return std::nullopt; } -llvm::Optional<llvm::StringRef> Object::getString(StringRef K) const { +std::optional<llvm::StringRef> Object::getString(StringRef K) const { if (auto *V = get(K)) return V->getAsString(); - return llvm::None; + return std::nullopt; } const json::Object *Object::getObject(StringRef K) const { if (auto *V = get(K)) @@ -408,7 +409,7 @@ private: C == 'e' || C == 'E' || C == '+' || C == '-' || C == '.'; } - Optional<Error> Err; + std::optional<Error> Err; const char *Start, *P, *End; }; |