[clang] 0a4c70f - [Targets] Use std::optional in RISCV.cpp (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 9 22:52:34 PST 2022
Author: Kazu Hirata
Date: 2022-12-09T22:52:29-08:00
New Revision: 0a4c70feb19fd95689e9a99d27114e217ada5da0
URL: https://github.com/llvm/llvm-project/commit/0a4c70feb19fd95689e9a99d27114e217ada5da0
DIFF: https://github.com/llvm/llvm-project/commit/0a4c70feb19fd95689e9a99d27114e217ada5da0.diff
LOG: [Targets] Use std::optional in RISCV.cpp (NFC)
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
Added:
Modified:
clang/lib/Basic/Targets/RISCV.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp
index b76ef15fa3771..86f7e026ebfe7 100644
--- a/clang/lib/Basic/Targets/RISCV.cpp
+++ b/clang/lib/Basic/Targets/RISCV.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/TargetParser.h"
#include "llvm/Support/raw_ostream.h"
+#include <optional>
using namespace clang;
using namespace clang::targets;
@@ -270,7 +271,7 @@ RISCVTargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
/// Return true if has this feature, need to sync with handleTargetFeatures.
bool RISCVTargetInfo::hasFeature(StringRef Feature) const {
bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64;
- auto Result = llvm::StringSwitch<Optional<bool>>(Feature)
+ auto Result = llvm::StringSwitch<std::optional<bool>>(Feature)
.Case("riscv", true)
.Case("riscv32", !Is64Bit)
.Case("riscv64", Is64Bit)
More information about the cfe-commits
mailing list