[lldb] Use std::nullopt instead of None (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
This commit is contained in:
Kazu Hirata
2022-12-05 20:54:05 -08:00
parent 9ba308f71c
commit d5c6dc8f02

View File

@@ -13,6 +13,7 @@
#include "ABIX86.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Target/Process.h"
#include <optional>
using namespace lldb;
using namespace lldb_private;
@@ -130,42 +131,44 @@ typedef llvm::SmallDenseMap<llvm::StringRef, llvm::SmallVector<RegData, 4>, 64>
#define GPRh(l) \
{ \
is64bit \
? BaseRegToRegsMap::value_type("r" l "x", \
{{GPR32, "e" l "x", llvm::None}, \
{GPR16, l "x", llvm::None}, \
{GPR8h, l "h", llvm::None}, \
{GPR8, l "l", llvm::None}}) \
: BaseRegToRegsMap::value_type("e" l "x", {{GPR16, l "x", llvm::None}, \
{GPR8h, l "h", llvm::None}, \
{GPR8, l "l", llvm::None}}) \
is64bit ? BaseRegToRegsMap::value_type("r" l "x", \
{{GPR32, "e" l "x", std::nullopt}, \
{GPR16, l "x", std::nullopt}, \
{GPR8h, l "h", std::nullopt}, \
{GPR8, l "l", std::nullopt}}) \
: BaseRegToRegsMap::value_type("e" l "x", \
{{GPR16, l "x", std::nullopt}, \
{GPR8h, l "h", std::nullopt}, \
{GPR8, l "l", std::nullopt}}) \
}
#define GPR(r16) \
{ \
is64bit \
? BaseRegToRegsMap::value_type("r" r16, {{GPR32, "e" r16, llvm::None}, \
{GPR16, r16, llvm::None}, \
{GPR8, r16 "l", llvm::None}}) \
: BaseRegToRegsMap::value_type("e" r16, {{GPR16, r16, llvm::None}, \
{GPR8, r16 "l", llvm::None}}) \
is64bit ? BaseRegToRegsMap::value_type("r" r16, \
{{GPR32, "e" r16, std::nullopt}, \
{GPR16, r16, std::nullopt}, \
{GPR8, r16 "l", std::nullopt}}) \
: BaseRegToRegsMap::value_type( \
"e" r16, \
{{GPR16, r16, std::nullopt}, {GPR8, r16 "l", std::nullopt}}) \
}
#define GPR64(n) \
{ \
BaseRegToRegsMap::value_type("r" #n, {{GPR32, "r" #n "d", llvm::None}, \
{GPR16, "r" #n "w", llvm::None}, \
{GPR8, "r" #n "l", llvm::None}}) \
BaseRegToRegsMap::value_type("r" #n, {{GPR32, "r" #n "d", std::nullopt}, \
{GPR16, "r" #n "w", std::nullopt}, \
{GPR8, "r" #n "l", std::nullopt}}) \
}
#define STMM(n) \
{ BaseRegToRegsMap::value_type("st" #n, {{MM, "mm" #n, llvm::None}}) }
{ BaseRegToRegsMap::value_type("st" #n, {{MM, "mm" #n, std::nullopt}}) }
#define YMM(n) \
{BaseRegToRegsMap::value_type("ymm" #n "h", \
{{YMM_YMMh, "ymm" #n, llvm::None}})}, \
{{YMM_YMMh, "ymm" #n, std::nullopt}})}, \
{ \
BaseRegToRegsMap::value_type("xmm" #n, {{YMM_XMM, "ymm" #n, llvm::None}}) \
BaseRegToRegsMap::value_type("xmm" #n, \
{{YMM_XMM, "ymm" #n, std::nullopt}}) \
}
BaseRegToRegsMap makeBaseRegMap(bool is64bit) {