14 changes: 7 additions & 7 deletions lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ bool ABISysV_ppc::GetArgumentValues(Thread &thread, ValueList &values) const {
// We currently only support extracting values with Clang QualTypes. Do we
// care about others?
CompilerType compiler_type = value->GetCompilerType();
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (!bit_size)
return false;
bool is_signed;
Expand Down Expand Up @@ -462,7 +462,7 @@ Status ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
error.SetErrorString(
"We don't support returning complex values at present");
else {
llvm::Optional<uint64_t> bit_width =
std::optional<uint64_t> bit_width =
compiler_type.GetBitSize(frame_sp.get());
if (!bit_width) {
error.SetErrorString("can't get type size");
Expand Down Expand Up @@ -526,7 +526,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple(
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers

llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
Expand Down Expand Up @@ -573,7 +573,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple(
if (type_flags & eTypeIsComplex) {
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
Expand Down Expand Up @@ -607,7 +607,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple(
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *altivec_reg = reg_ctx->GetRegisterInfoByName("v2", 0);
Expand Down Expand Up @@ -658,7 +658,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectImpl(
if (!reg_ctx_sp)
return return_valobj_sp;

llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
if (!bit_width)
return return_valobj_sp;
if (return_compiler_type.IsAggregateType()) {
Expand Down Expand Up @@ -700,7 +700,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectImpl(

CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
idx, name, &field_bit_offset, nullptr, nullptr);
llvm::Optional<uint64_t> field_bit_width =
std::optional<uint64_t> field_bit_width =
field_compiler_type.GetBitSize(&thread);
if (!field_bit_width)
return return_valobj_sp;
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ bool ABISysV_ppc64::GetArgumentValues(Thread &thread, ValueList &values) const {
// We currently only support extracting values with Clang QualTypes. Do we
// care about others?
CompilerType compiler_type = value->GetCompilerType();
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (!bit_size)
return false;
bool is_signed;
Expand Down Expand Up @@ -342,7 +342,7 @@ Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
error.SetErrorString(
"We don't support returning complex values at present");
else {
llvm::Optional<uint64_t> bit_width =
std::optional<uint64_t> bit_width =
compiler_type.GetBitSize(frame_sp.get());
if (!bit_width) {
error.SetErrorString("can't get size of type");
Expand Down Expand Up @@ -644,7 +644,7 @@ class ReturnValueExtractor {
DataExtractor de(&raw_data, sizeof(raw_data), m_byte_order, m_addr_size);

offset_t offset = 0;
llvm::Optional<uint64_t> byte_size = type.GetByteSize(m_process_sp.get());
std::optional<uint64_t> byte_size = type.GetByteSize(m_process_sp.get());
if (!byte_size)
return {};
switch (*byte_size) {
Expand Down Expand Up @@ -778,7 +778,7 @@ class ReturnValueExtractor {
CompilerType elem_type;
if (m_type.IsHomogeneousAggregate(&elem_type)) {
uint32_t type_flags = elem_type.GetTypeInfo();
llvm::Optional<uint64_t> elem_size =
std::optional<uint64_t> elem_size =
elem_type.GetByteSize(m_process_sp.get());
if (!elem_size)
return {};
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ bool ABISysV_s390x::GetArgumentValues(Thread &thread, ValueList &values) const {
// We currently only support extracting values with Clang QualTypes. Do we
// care about others?
CompilerType compiler_type = value->GetCompilerType();
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (!bit_size)
return false;
bool is_signed;
Expand Down Expand Up @@ -426,7 +426,7 @@ Status ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
error.SetErrorString(
"We don't support returning complex values at present");
else {
llvm::Optional<uint64_t> bit_width =
std::optional<uint64_t> bit_width =
compiler_type.GetBitSize(frame_sp.get());
if (!bit_width) {
error.SetErrorString("can't get type size");
Expand Down Expand Up @@ -493,7 +493,7 @@ ValueObjectSP ABISysV_s390x::GetReturnValueObjectSimple(
bool success = false;
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers.
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
Expand Down Expand Up @@ -540,7 +540,7 @@ ValueObjectSP ABISysV_s390x::GetReturnValueObjectSimple(
if (type_flags & eTypeIsComplex) {
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ bool ABIMacOSX_i386::GetArgumentValues(Thread &thread,
// We currently only support extracting values with Clang QualTypes. Do we
// care about others?
CompilerType compiler_type(value->GetCompilerType());
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (bit_size) {
bool is_signed;
if (compiler_type.IsIntegerOrEnumerationType(is_signed))
Expand Down Expand Up @@ -274,7 +274,7 @@ ABIMacOSX_i386::GetReturnValueObjectImpl(Thread &thread,
bool is_signed;

if (compiler_type.IsIntegerOrEnumerationType(is_signed)) {
llvm::Optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread);
if (!bit_width)
return return_valobj_sp;
unsigned eax_id =
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ bool ABISysV_i386::GetArgumentValues(Thread &thread, ValueList &values) const {

// Currently: Support for extracting values with Clang QualTypes only.
CompilerType compiler_type(value->GetCompilerType());
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (bit_size) {
bool is_signed;
if (compiler_type.IsIntegerOrEnumerationType(is_signed)) {
Expand Down Expand Up @@ -387,7 +387,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple(
(type_flags & eTypeIsEnumeration)) //'Integral' + 'Floating Point'
{
value.SetValueType(Value::ValueType::Scalar);
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
Expand Down Expand Up @@ -512,7 +512,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple(
// ToDo: Yet to be implemented
} else if (type_flags & eTypeIsVector) // 'Packed'
{
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *vec_reg = reg_ctx->GetRegisterInfoByName("xmm0", 0);
Expand Down
16 changes: 8 additions & 8 deletions lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ bool ABISysV_x86_64::GetArgumentValues(Thread &thread,
// We currently only support extracting values with Clang QualTypes. Do we
// care about others?
CompilerType compiler_type = value->GetCompilerType();
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (!bit_size)
return false;
bool is_signed;
Expand Down Expand Up @@ -338,7 +338,7 @@ Status ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
error.SetErrorString(
"We don't support returning complex values at present");
else {
llvm::Optional<uint64_t> bit_width =
std::optional<uint64_t> bit_width =
compiler_type.GetBitSize(frame_sp.get());
if (!bit_width) {
error.SetErrorString("can't get type size");
Expand Down Expand Up @@ -407,7 +407,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers

llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
Expand Down Expand Up @@ -454,7 +454,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
if (type_flags & eTypeIsComplex) {
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *xmm0_info =
Expand Down Expand Up @@ -493,7 +493,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *altivec_reg =
Expand Down Expand Up @@ -588,8 +588,8 @@ static bool FlattenAggregateType(
uint64_t field_bit_offset = 0;
CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
idx, name, &field_bit_offset, nullptr, nullptr);
llvm::Optional<uint64_t> field_bit_width =
field_compiler_type.GetBitSize(&thread);
std::optional<uint64_t> field_bit_width =
field_compiler_type.GetBitSize(&thread);

// if we don't know the size of the field (e.g. invalid type), exit
if (!field_bit_width || *field_bit_width == 0) {
Expand Down Expand Up @@ -631,7 +631,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectImpl(
if (!reg_ctx_sp)
return return_valobj_sp;

llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
if (!bit_width)
return return_valobj_sp;
if (return_compiler_type.IsAggregateType()) {
Expand Down
16 changes: 8 additions & 8 deletions lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ bool ABIWindows_x86_64::GetArgumentValues(Thread &thread,
return false;

CompilerType compiler_type = value->GetCompilerType();
llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (!bit_size)
return false;
bool is_signed;
Expand Down Expand Up @@ -345,7 +345,7 @@ Status ABIWindows_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
error.SetErrorString(
"We don't support returning complex values at present");
else {
llvm::Optional<uint64_t> bit_width =
std::optional<uint64_t> bit_width =
compiler_type.GetBitSize(frame_sp.get());
if (!bit_width) {
error.SetErrorString("can't get type size");
Expand Down Expand Up @@ -415,7 +415,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectSimple(
bool success = false;
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
Expand Down Expand Up @@ -462,7 +462,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectSimple(
if (type_flags & eTypeIsComplex) {
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *xmm0_info =
Expand Down Expand Up @@ -500,7 +500,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectSimple(
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
llvm::Optional<uint64_t> byte_size =
std::optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *xmm_reg =
Expand Down Expand Up @@ -561,8 +561,8 @@ static bool FlattenAggregateType(
uint64_t field_bit_offset = 0;
CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
idx, name, &field_bit_offset, nullptr, nullptr);
llvm::Optional<uint64_t> field_bit_width =
field_compiler_type.GetBitSize(&thread);
std::optional<uint64_t> field_bit_width =
field_compiler_type.GetBitSize(&thread);

// if we don't know the size of the field (e.g. invalid type), exit
if (!field_bit_width || *field_bit_width == 0) {
Expand Down Expand Up @@ -612,7 +612,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectImpl(
return return_valobj_sp;
}

llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
std::optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
if (!bit_width) {
return return_valobj_sp;
}
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ABI/X86/ABIX86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ enum RegKind {
struct RegData {
RegKind subreg_kind;
llvm::StringRef subreg_name;
llvm::Optional<uint32_t> base_index;
std::optional<uint32_t> base_index;
};

static void
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ MapOpcodeIntoControlFlowKind(InstructionOpcodeAndModrm opcode_and_modrm) {
/// primary_opcode, opcode_len and modrm byte. Refer to the struct definition
/// for more details.
/// Otherwise if the given instruction is invalid, returns std::nullopt.
llvm::Optional<InstructionOpcodeAndModrm>
std::optional<InstructionOpcodeAndModrm>
InstructionLengthDecode(const uint8_t *inst_bytes, int bytes_len,
bool is_exec_mode_64b) {
int op_idx = 0;
Expand Down Expand Up @@ -385,7 +385,7 @@ InstructionLengthDecode(const uint8_t *inst_bytes, int bytes_len,

lldb::InstructionControlFlowKind GetControlFlowKind(bool is_exec_mode_64b,
Opcode m_opcode) {
llvm::Optional<InstructionOpcodeAndModrm> ret;
std::optional<InstructionOpcodeAndModrm> ret;

if (m_opcode.GetOpcodeBytes() == nullptr || m_opcode.GetByteSize() <= 0) {
// x86_64 and i386 instructions are categorized as Opcode::Type::eTypeBytes
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DisassemblerLLVMC : public lldb_private::Disassembler {
// this is a pc-relative address calculation and we need both
// parts to calculate the symbolication.
lldb::addr_t m_adrp_address;
llvm::Optional<uint32_t> m_adrp_insn;
std::optional<uint32_t> m_adrp_insn;

// Since we need to make two actual MC Disassemblers for ARM (ARM & THUMB),
// and there's a bit of goo to set up and own in the MC disassembler world,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,11 @@ addr_t DynamicLoaderPOSIXDYLD::ComputeLoadOffset() {
}

void DynamicLoaderPOSIXDYLD::EvalSpecialModulesStatus() {
if (llvm::Optional<uint64_t> vdso_base =
if (std::optional<uint64_t> vdso_base =
m_auxv->GetAuxValue(AuxVector::AUXV_AT_SYSINFO_EHDR))
m_vdso_base = *vdso_base;

if (llvm::Optional<uint64_t> interpreter_base =
if (std::optional<uint64_t> interpreter_base =
m_auxv->GetAuxValue(AuxVector::AUXV_AT_BASE))
m_interpreter_base = *interpreter_base;
}
Expand All @@ -711,7 +711,7 @@ addr_t DynamicLoaderPOSIXDYLD::GetEntryPoint() {
if (m_auxv == nullptr)
return LLDB_INVALID_ADDRESS;

llvm::Optional<uint64_t> entry_point =
std::optional<uint64_t> entry_point =
m_auxv->GetAuxValue(AuxVector::AUXV_AT_ENTRY);
if (!entry_point)
return LLDB_INVALID_ADDRESS;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ExternalASTSourceWrapper : public clang::ExternalSemaSource {
return m_Source->getModule(ID);
}

llvm::Optional<clang::ASTSourceDescriptor>
std::optional<clang::ASTSourceDescriptor>
getSourceDescriptor(unsigned ID) override {
return m_Source->getSourceDescriptor(ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ ClangASTImporter::MapCompleter::~MapCompleter() = default;
llvm::Expected<Decl *>
ClangASTImporter::ASTImporterDelegate::ImportImpl(Decl *From) {
if (m_std_handler) {
llvm::Optional<Decl *> D = m_std_handler->Import(From);
std::optional<Decl *> D = m_std_handler->Import(From);
if (D) {
// Make sure we don't use this decl later to map it back to it's original
// decl. The decl the CxxModuleHandler created has nothing to do with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ class CodeComplete : public CodeCompleteConsumer {
/// should always be const-qualified.
/// \return Returns std::nullopt if no completion should be provided for the
/// given CodeCompletionResult.
llvm::Optional<CompletionWithPriority>
std::optional<CompletionWithPriority>
getCompletionForResult(const CodeCompletionResult &R) const {
std::string ToInsert;
std::string Description;
Expand Down Expand Up @@ -966,7 +966,7 @@ class CodeComplete : public CodeCompleteConsumer {
continue;

CodeCompletionResult &R = Results[I];
llvm::Optional<CompletionWithPriority> CompletionAndPriority =
std::optional<CompletionWithPriority> CompletionAndPriority =
getCompletionForResult(R);
if (!CompletionAndPriority)
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ClangExternalASTSourceCallbacks::RegisterModule(clang::Module *module) {
return OptionalClangModuleID(id);
}

llvm::Optional<clang::ASTSourceDescriptor>
std::optional<clang::ASTSourceDescriptor>
ClangExternalASTSourceCallbacks::getSourceDescriptor(unsigned id) {
if (clang::Module *module = getModule(id))
return {*module};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource {

/// Module-related methods.
/// \{
llvm::Optional<clang::ASTSourceDescriptor>
std::optional<clang::ASTSourceDescriptor>
getSourceDescriptor(unsigned ID) override;
clang::Module *getModule(unsigned ID) override;
OptionalClangModuleID RegisterModule(clang::Module *module);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void ClangPersistentVariables::RemovePersistentVariable(
m_next_persistent_variable_id--;
}

llvm::Optional<CompilerType>
std::optional<CompilerType>
ClangPersistentVariables::GetCompilerTypeFromPersistentDecl(
ConstString type_name) {
PersistentDecl p = m_persistent_decls.lookup(type_name.GetCString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ClangPersistentVariables : public PersistentExpressionState {
return name;
}

llvm::Optional<CompilerType>
std::optional<CompilerType>
GetCompilerTypeFromPersistentDecl(ConstString type_name) override;

void RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class ClangUserExpression : public LLVMUserExpression {
/// The absolute character position in the transformed source code where the
/// user code (as typed by the user) starts. If the variable is empty, then we
/// were not able to calculate this position.
llvm::Optional<size_t> m_user_expression_start_pos;
std::optional<size_t> m_user_expression_start_pos;
ResultDelegate m_result_delegate;
ClangPersistentVariables *m_clang_state;
std::unique_ptr<ClangExpressionSourceCode> m_source_code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ getTargetIncludePaths(const llvm::Triple &triple) {

/// Returns the include path matching the given pattern for the given file
/// path (or std::nullopt if the path doesn't match the pattern).
static llvm::Optional<llvm::StringRef>
static std::optional<llvm::StringRef>
guessIncludePath(llvm::StringRef path_to_file, llvm::StringRef pattern) {
if (pattern.empty())
return std::nullopt;
Expand Down Expand Up @@ -84,7 +84,7 @@ bool CppModuleConfiguration::analyzeFile(const FileSpec &f,
(posix_dir + triple.str() + "/c++/v1").str());
}

llvm::Optional<llvm::StringRef> inc_path;
std::optional<llvm::StringRef> inc_path;
// Target specific paths contains /usr/include, so we check them first
for (auto &path : getTargetIncludePaths(triple)) {
if ((inc_path = guessIncludePath(posix_dir, path)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ T *createDecl(ASTImporter &importer, Decl *from_d, Args &&... args) {
return to_d;
}

llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
std::optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
Log *log = GetLog(LLDBLog::Expressions);

// If we don't have a template to instiantiate, then there is nothing to do.
Expand Down Expand Up @@ -288,7 +288,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
return result;
}

llvm::Optional<Decl *> CxxModuleHandler::Import(Decl *d) {
std::optional<Decl *> CxxModuleHandler::Import(Decl *d) {
if (!isValid())
return {};

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CxxModuleHandler {

/// Tries to manually instantiate the given foreign template in the target
/// context (designated by m_sema).
llvm::Optional<clang::Decl *> tryInstantiateStdTemplate(clang::Decl *d);
std::optional<clang::Decl *> tryInstantiateStdTemplate(clang::Decl *d);

public:
CxxModuleHandler() = default;
Expand All @@ -54,7 +54,7 @@ class CxxModuleHandler {
/// deserializing it from the 'std' module. This function returns a Decl if a
/// Decl has been deserialized from the 'std' module. Otherwise this function
/// returns nothing.
llvm::Optional<clang::Decl *> Import(clang::Decl *d);
std::optional<clang::Decl *> Import(clang::Decl *d);

/// Returns true iff this instance is capable of importing any declarations
/// in the target ASTContext.
Expand Down
7 changes: 3 additions & 4 deletions lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
}

lldb::TargetSP target_sp(m_execution_unit.GetTarget());
llvm::Optional<uint64_t> bit_size = m_result_type.GetBitSize(target_sp.get());
std::optional<uint64_t> bit_size = m_result_type.GetBitSize(target_sp.get());
if (!bit_size) {
lldb_private::StreamString type_desc_stream;
m_result_type.DumpTypeDescription(&type_desc_stream);
Expand Down Expand Up @@ -1194,11 +1194,10 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
}

auto *target = m_execution_unit.GetTarget().get();
llvm::Optional<uint64_t> value_size = compiler_type.GetByteSize(target);
std::optional<uint64_t> value_size = compiler_type.GetByteSize(target);
if (!value_size)
return false;
llvm::Optional<size_t> opt_alignment =
compiler_type.GetTypeBitAlign(target);
std::optional<size_t> opt_alignment = compiler_type.GetTypeBitAlign(target);
if (!opt_alignment)
return false;
lldb::offset_t value_alignment = (*opt_alignment + 7ull) / 8ull;
Expand Down
218 changes: 109 additions & 109 deletions lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ class EmulateInstructionARM : public EmulateInstruction {
bool TestEmulation(Stream *out_stream, ArchSpec &arch,
OptionValueDictionary *test_data) override;

llvm::Optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;
std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;

bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;

Expand Down
22 changes: 11 additions & 11 deletions lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ using namespace lldb_private;

LLDB_PLUGIN_DEFINE_ADV(EmulateInstructionARM64, InstructionARM64)

static llvm::Optional<RegisterInfo> LLDBTableGetRegisterInfo(uint32_t reg_num) {
static std::optional<RegisterInfo> LLDBTableGetRegisterInfo(uint32_t reg_num) {
if (reg_num >= std::size(g_register_infos_arm64_le))
return {};
return g_register_infos_arm64_le[reg_num];
Expand Down Expand Up @@ -144,7 +144,7 @@ bool EmulateInstructionARM64::SetTargetTriple(const ArchSpec &arch) {
return false;
}

llvm::Optional<RegisterInfo>
std::optional<RegisterInfo>
EmulateInstructionARM64::GetRegisterInfo(RegisterKind reg_kind,
uint32_t reg_num) {
if (reg_kind == eRegisterKindGeneric) {
Expand Down Expand Up @@ -664,7 +664,7 @@ bool EmulateInstructionARM64::EmulateADDSUBImm(const uint32_t opcode) {
}

Context context;
llvm::Optional<RegisterInfo> reg_info_Rn =
std::optional<RegisterInfo> reg_info_Rn =
GetRegisterInfo(eRegisterKindLLDB, n);
if (reg_info_Rn)
context.SetRegisterPlusOffset(*reg_info_Rn, imm);
Expand Down Expand Up @@ -769,13 +769,13 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) {
uint64_t address;
uint64_t wb_address;

llvm::Optional<RegisterInfo> reg_info_base =
std::optional<RegisterInfo> reg_info_base =
GetRegisterInfo(eRegisterKindLLDB, gpr_x0_arm64 + n);
if (!reg_info_base)
return false;

llvm::Optional<RegisterInfo> reg_info_Rt;
llvm::Optional<RegisterInfo> reg_info_Rt2;
std::optional<RegisterInfo> reg_info_Rt;
std::optional<RegisterInfo> reg_info_Rt2;

if (vector) {
reg_info_Rt = GetRegisterInfo(eRegisterKindLLDB, fpu_d0_arm64 + t);
Expand Down Expand Up @@ -823,7 +823,7 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) {
context_t2.SetRegisterToRegisterPlusOffset(*reg_info_Rt2, *reg_info_base,
size);

llvm::Optional<RegisterValue> data_Rt = ReadRegister(*reg_info_Rt);
std::optional<RegisterValue> data_Rt = ReadRegister(*reg_info_Rt);
if (!data_Rt)
return false;

Expand All @@ -834,7 +834,7 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) {
if (!WriteMemory(context_t, address + 0, buffer, reg_info_Rt->byte_size))
return false;

llvm::Optional<RegisterValue> data_Rt2 = ReadRegister(*reg_info_Rt2);
std::optional<RegisterValue> data_Rt2 = ReadRegister(*reg_info_Rt2);
if (!data_Rt2)
return false;

Expand Down Expand Up @@ -974,12 +974,12 @@ bool EmulateInstructionARM64::EmulateLDRSTRImm(const uint32_t opcode) {
if (!postindex)
address += offset;

llvm::Optional<RegisterInfo> reg_info_base =
std::optional<RegisterInfo> reg_info_base =
GetRegisterInfo(eRegisterKindLLDB, gpr_x0_arm64 + n);
if (!reg_info_base)
return false;

llvm::Optional<RegisterInfo> reg_info_Rt =
std::optional<RegisterInfo> reg_info_Rt =
GetRegisterInfo(eRegisterKindLLDB, gpr_x0_arm64 + t);
if (!reg_info_Rt)
return false;
Expand All @@ -996,7 +996,7 @@ bool EmulateInstructionARM64::EmulateLDRSTRImm(const uint32_t opcode) {
context.SetRegisterToRegisterPlusOffset(*reg_info_Rt, *reg_info_base,
postindex ? 0 : offset);

llvm::Optional<RegisterValue> data_Rt = ReadRegister(*reg_info_Rt);
std::optional<RegisterValue> data_Rt = ReadRegister(*reg_info_Rt);
if (!data_Rt)
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class EmulateInstructionARM64 : public lldb_private::EmulateInstruction {
return false;
}

llvm::Optional<lldb_private::RegisterInfo>
std::optional<lldb_private::RegisterInfo>
GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) override;

bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool EmulateInstructionLoongArch::WritePC(lldb::addr_t pc) {
LLDB_REGNUM_GENERIC_PC, pc);
}

llvm::Optional<RegisterInfo>
std::optional<RegisterInfo>
EmulateInstructionLoongArch::GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_index) {
if (reg_kind == eRegisterKindGeneric) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class EmulateInstructionLoongArch : public EmulateInstruction {
bool TestEmulation(Stream *out_stream, ArchSpec &arch,
OptionValueDictionary *test_data) override;

llvm::Optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;
std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;
lldb::addr_t ReadPC(bool *success);
bool WritePC(lldb::addr_t pc);
bool IsLoongArch64() { return m_arch_subtype == llvm::Triple::loongarch64; }
Expand Down
34 changes: 17 additions & 17 deletions lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ const char *EmulateInstructionMIPS::GetRegisterName(unsigned reg_num,
return nullptr;
}

llvm::Optional<RegisterInfo>
std::optional<RegisterInfo>
EmulateInstructionMIPS::GetRegisterInfo(RegisterKind reg_kind,
uint32_t reg_num) {
if (reg_kind == eRegisterKindGeneric) {
Expand Down Expand Up @@ -1198,7 +1198,7 @@ bool EmulateInstructionMIPS::Emulate_ADDiu(llvm::MCInst &insn) {
/* Check if this is daddiu sp, sp, imm16 */
if (dst == dwarf_sp_mips) {
uint64_t result = src_opd_val + imm;
llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, imm);
Expand Down Expand Up @@ -1233,7 +1233,7 @@ bool EmulateInstructionMIPS::Emulate_SW(llvm::MCInst &insn) {
src = m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
base = m_reg_info->getEncodingValue(insn.getOperand(1).getReg());

llvm::Optional<RegisterInfo> reg_info_base =
std::optional<RegisterInfo> reg_info_base =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + base);
if (!reg_info_base)
return false;
Expand All @@ -1254,7 +1254,7 @@ bool EmulateInstructionMIPS::Emulate_SW(llvm::MCInst &insn) {

/* We look for sp based non-volatile register stores */
if (nonvolatile_reg_p(src)) {
llvm::Optional<RegisterInfo> reg_info_src =
std::optional<RegisterInfo> reg_info_src =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + src);
if (!reg_info_src)
return false;
Expand All @@ -1266,7 +1266,7 @@ bool EmulateInstructionMIPS::Emulate_SW(llvm::MCInst &insn) {
uint8_t buffer[RegisterValue::kMaxRegisterByteSize];
Status error;

llvm::Optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
std::optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
if (!data_src)
return false;

Expand Down Expand Up @@ -1313,7 +1313,7 @@ bool EmulateInstructionMIPS::Emulate_LW(llvm::MCInst &insn) {

if (nonvolatile_reg_p(src)) {
RegisterValue data_src;
llvm::Optional<RegisterInfo> reg_info_src =
std::optional<RegisterInfo> reg_info_src =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + src);
if (!reg_info_src)
return false;
Expand Down Expand Up @@ -1363,7 +1363,7 @@ bool EmulateInstructionMIPS::Emulate_SUBU_ADDU(llvm::MCInst &insn) {
result = src_opd_val + rt_opd_val;

Context context;
llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, rt_opd_val);
Expand Down Expand Up @@ -1439,7 +1439,7 @@ bool EmulateInstructionMIPS::Emulate_ADDIUSP(llvm::MCInst &insn) {
result = src_opd_val + imm9;

Context context;
llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, imm9);
Expand Down Expand Up @@ -1471,7 +1471,7 @@ bool EmulateInstructionMIPS::Emulate_ADDIUS5(llvm::MCInst &insn) {
result = src_opd_val + imm4;

Context context;
llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, imm4);
Expand All @@ -1495,7 +1495,7 @@ bool EmulateInstructionMIPS::Emulate_SWSP(llvm::MCInst &insn) {
src = m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
base = m_reg_info->getEncodingValue(insn.getOperand(1).getReg());

llvm::Optional<RegisterInfo> reg_info_base =
std::optional<RegisterInfo> reg_info_base =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + base);
if (!reg_info_base)
return false;
Expand Down Expand Up @@ -1526,7 +1526,7 @@ bool EmulateInstructionMIPS::Emulate_SWSP(llvm::MCInst &insn) {
uint8_t buffer[RegisterValue::kMaxRegisterByteSize];
Status error;

llvm::Optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
std::optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
if (!data_src)
return false;

Expand Down Expand Up @@ -1567,7 +1567,7 @@ bool EmulateInstructionMIPS::Emulate_SWM16_32(llvm::MCInst &insn) {
// offset is always the last operand.
uint32_t offset = insn.getOperand(num_operands - 1).getImm();

llvm::Optional<RegisterInfo> reg_info_base =
std::optional<RegisterInfo> reg_info_base =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + base);
if (!reg_info_base)
return false;
Expand Down Expand Up @@ -1596,7 +1596,7 @@ bool EmulateInstructionMIPS::Emulate_SWM16_32(llvm::MCInst &insn) {
if (!nonvolatile_reg_p(src))
return false;

llvm::Optional<RegisterInfo> reg_info_src =
std::optional<RegisterInfo> reg_info_src =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + src);
if (!reg_info_src)
return false;
Expand All @@ -1608,7 +1608,7 @@ bool EmulateInstructionMIPS::Emulate_SWM16_32(llvm::MCInst &insn) {
uint8_t buffer[RegisterValue::kMaxRegisterByteSize];
Status error;

llvm::Optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
std::optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
if (!data_src)
return false;

Expand Down Expand Up @@ -1653,7 +1653,7 @@ bool EmulateInstructionMIPS::Emulate_LWSP(llvm::MCInst &insn) {

if (base == dwarf_sp_mips && nonvolatile_reg_p(src)) {
RegisterValue data_src;
llvm::Optional<RegisterInfo> reg_info_src =
std::optional<RegisterInfo> reg_info_src =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + src);
if (!reg_info_src)
return false;
Expand Down Expand Up @@ -1715,7 +1715,7 @@ bool EmulateInstructionMIPS::Emulate_LWM16_32(llvm::MCInst &insn) {
if (!nonvolatile_reg_p(dst))
return false;

llvm::Optional<RegisterInfo> reg_info_dst =
std::optional<RegisterInfo> reg_info_dst =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips + dst);
if (!reg_info_dst)
return false;
Expand Down Expand Up @@ -1761,7 +1761,7 @@ bool EmulateInstructionMIPS::Emulate_JRADDIUSP(llvm::MCInst &insn) {
ra_val))
return false;

llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, imm5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class EmulateInstructionMIPS : public lldb_private::EmulateInstruction {
return false;
}

llvm::Optional<lldb_private::RegisterInfo>
std::optional<lldb_private::RegisterInfo>
GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) override;

bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ const char *EmulateInstructionMIPS64::GetRegisterName(unsigned reg_num,
return nullptr;
}

llvm::Optional<RegisterInfo>
std::optional<RegisterInfo>
EmulateInstructionMIPS64::GetRegisterInfo(RegisterKind reg_kind,
uint32_t reg_num) {
if (reg_kind == eRegisterKindGeneric) {
Expand Down Expand Up @@ -1099,7 +1099,7 @@ bool EmulateInstructionMIPS64::Emulate_DADDiu(llvm::MCInst &insn) {
* Assume 2's complement and rely on unsigned overflow here.
*/
uint64_t result = src_opd_val + imm;
llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips64);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, imm);
Expand Down Expand Up @@ -1135,9 +1135,9 @@ bool EmulateInstructionMIPS64::Emulate_SD(llvm::MCInst &insn) {
src = m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
base = m_reg_info->getEncodingValue(insn.getOperand(1).getReg());

llvm::Optional<RegisterInfo> reg_info_base =
std::optional<RegisterInfo> reg_info_base =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips64 + base);
llvm::Optional<RegisterInfo> reg_info_src =
std::optional<RegisterInfo> reg_info_src =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips64 + src);
if (!reg_info_base || !reg_info_src)
return false;
Expand All @@ -1160,7 +1160,7 @@ bool EmulateInstructionMIPS64::Emulate_SD(llvm::MCInst &insn) {
uint8_t buffer[RegisterValue::kMaxRegisterByteSize];
Status error;

llvm::Optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
std::optional<RegisterValue> data_src = ReadRegister(*reg_info_base);
if (!data_src)
return false;

Expand Down Expand Up @@ -1210,7 +1210,7 @@ bool EmulateInstructionMIPS64::Emulate_LD(llvm::MCInst &insn) {

if (nonvolatile_reg_p(src)) {
RegisterValue data_src;
llvm::Optional<RegisterInfo> reg_info_src =
std::optional<RegisterInfo> reg_info_src =
GetRegisterInfo(eRegisterKindDWARF, dwarf_zero_mips64 + src);
if (!reg_info_src)
return false;
Expand Down Expand Up @@ -1277,7 +1277,7 @@ bool EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(llvm::MCInst &insn) {
result = src_opd_val + rt_opd_val;

Context context;
llvm::Optional<RegisterInfo> reg_info_sp =
std::optional<RegisterInfo> reg_info_sp =
GetRegisterInfo(eRegisterKindDWARF, dwarf_sp_mips64);
if (reg_info_sp)
context.SetRegisterPlusOffset(*reg_info_sp, rt_opd_val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class EmulateInstructionMIPS64 : public lldb_private::EmulateInstruction {
return false;
}

llvm::Optional<lldb_private::RegisterInfo>
std::optional<lldb_private::RegisterInfo>
GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) override;

bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ bool EmulateInstructionPPC64::SetTargetTriple(const ArchSpec &arch) {
return arch.GetTriple().isPPC64();
}

static llvm::Optional<RegisterInfo> LLDBTableGetRegisterInfo(uint32_t reg_num) {
static std::optional<RegisterInfo> LLDBTableGetRegisterInfo(uint32_t reg_num) {
if (reg_num >= std::size(g_register_infos_ppc64le))
return {};
return g_register_infos_ppc64le[reg_num];
}

llvm::Optional<RegisterInfo>
std::optional<RegisterInfo>
EmulateInstructionPPC64::GetRegisterInfo(RegisterKind reg_kind,
uint32_t reg_num) {
if (reg_kind == eRegisterKindGeneric) {
Expand Down Expand Up @@ -240,7 +240,7 @@ bool EmulateInstructionPPC64::EmulateLD(uint32_t opcode) {
Log *log = GetLog(LLDBLog::Unwind);
LLDB_LOG(log, "EmulateLD: {0:X+8}: ld r{1}, {2}(r{3})", m_addr, rt, ids, ra);

llvm::Optional<RegisterInfo> r1_info =
std::optional<RegisterInfo> r1_info =
GetRegisterInfo(eRegisterKindLLDB, gpr_r1_ppc64le);
if (!r1_info)
return false;
Expand Down Expand Up @@ -291,11 +291,11 @@ bool EmulateInstructionPPC64::EmulateSTD(uint32_t opcode) {
}

// set context
llvm::Optional<RegisterInfo> rs_info =
std::optional<RegisterInfo> rs_info =
GetRegisterInfo(eRegisterKindLLDB, rs_num);
if (!rs_info)
return false;
llvm::Optional<RegisterInfo> ra_info = GetRegisterInfo(eRegisterKindLLDB, ra);
std::optional<RegisterInfo> ra_info = GetRegisterInfo(eRegisterKindLLDB, ra);
if (!ra_info)
return false;

Expand Down Expand Up @@ -337,7 +337,7 @@ bool EmulateInstructionPPC64::EmulateOR(uint32_t opcode) {
LLDB_LOG(log, "EmulateOR: {0:X+8}: mr r{1}, r{2}", m_addr, ra, rb);

// set context
llvm::Optional<RegisterInfo> ra_info = GetRegisterInfo(eRegisterKindLLDB, ra);
std::optional<RegisterInfo> ra_info = GetRegisterInfo(eRegisterKindLLDB, ra);
if (!ra_info)
return false;

Expand Down Expand Up @@ -372,7 +372,7 @@ bool EmulateInstructionPPC64::EmulateADDI(uint32_t opcode) {
LLDB_LOG(log, "EmulateADDI: {0:X+8}: addi r1, r1, {1}", m_addr, si_val);

// set context
llvm::Optional<RegisterInfo> r1_info =
std::optional<RegisterInfo> r1_info =
GetRegisterInfo(eRegisterKindLLDB, gpr_r1_ppc64le);
if (!r1_info)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class EmulateInstructionPPC64 : public EmulateInstruction {
return false;
}

llvm::Optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;
std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;

bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;

Expand Down
40 changes: 21 additions & 19 deletions lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ namespace lldb_private {
/// Returns all values wrapped in Optional, or std::nullopt if any of the values
/// is std::nullopt.
template <typename... Ts>
static Optional<std::tuple<Ts...>> zipOpt(Optional<Ts> &&...ts) {
static std::optional<std::tuple<Ts...>> zipOpt(std::optional<Ts> &&...ts) {
if ((ts.has_value() && ...))
return Optional<std::tuple<Ts...>>(std::make_tuple(std::move(*ts)...));
return std::optional<std::tuple<Ts...>>(std::make_tuple(std::move(*ts)...));
else
return std::nullopt;
}
Expand Down Expand Up @@ -130,31 +130,31 @@ bool Rd::WriteAPFloat(EmulateInstructionRISCV &emulator, APFloat value) {
registerValue);
}

Optional<uint64_t> Rs::Read(EmulateInstructionRISCV &emulator) {
std::optional<uint64_t> Rs::Read(EmulateInstructionRISCV &emulator) {
uint32_t lldbReg = GPREncodingToLLDB(rs);
RegisterValue value;
return emulator.ReadRegister(eRegisterKindLLDB, lldbReg, value)
? Optional<uint64_t>(value.GetAsUInt64())
? std::optional<uint64_t>(value.GetAsUInt64())
: std::nullopt;
}

Optional<int32_t> Rs::ReadI32(EmulateInstructionRISCV &emulator) {
std::optional<int32_t> Rs::ReadI32(EmulateInstructionRISCV &emulator) {
return transformOptional(
Read(emulator), [](uint64_t value) { return int32_t(uint32_t(value)); });
}

Optional<int64_t> Rs::ReadI64(EmulateInstructionRISCV &emulator) {
std::optional<int64_t> Rs::ReadI64(EmulateInstructionRISCV &emulator) {
return transformOptional(Read(emulator),
[](uint64_t value) { return int64_t(value); });
}

Optional<uint32_t> Rs::ReadU32(EmulateInstructionRISCV &emulator) {
std::optional<uint32_t> Rs::ReadU32(EmulateInstructionRISCV &emulator) {
return transformOptional(Read(emulator),
[](uint64_t value) { return uint32_t(value); });
}

Optional<APFloat> Rs::ReadAPFloat(EmulateInstructionRISCV &emulator,
bool isDouble) {
std::optional<APFloat> Rs::ReadAPFloat(EmulateInstructionRISCV &emulator,
bool isDouble) {
uint32_t lldbReg = FPREncodingToLLDB(rs);
RegisterValue value;
if (!emulator.ReadRegister(eRegisterKindLLDB, lldbReg, value))
Expand Down Expand Up @@ -216,7 +216,7 @@ constexpr bool is_amo_cmp =
std::is_same_v<T, AMOMAXU_W> || std::is_same_v<T, AMOMAXU_D>;

template <typename I>
static std::enable_if_t<is_load<I> || is_store<I>, Optional<uint64_t>>
static std::enable_if_t<is_load<I> || is_store<I>, std::optional<uint64_t>>
LoadStoreAddr(EmulateInstructionRISCV &emulator, I inst) {
return transformOptional(inst.rs1.Read(emulator), [&](uint64_t rs1) {
return rs1 + uint64_t(SignExt(inst.imm));
Expand Down Expand Up @@ -251,12 +251,13 @@ Store(EmulateInstructionRISCV &emulator, I inst) {
template <typename I>
static std::enable_if_t<is_amo_add<I> || is_amo_bit_op<I> || is_amo_swap<I> ||
is_amo_cmp<I>,
Optional<uint64_t>>
std::optional<uint64_t>>
AtomicAddr(EmulateInstructionRISCV &emulator, I inst, unsigned int align) {
return transformOptional(inst.rs1.Read(emulator),
[&](uint64_t rs1) {
return rs1 % align == 0 ? Optional<uint64_t>(rs1)
: std::nullopt;
return rs1 % align == 0
? std::optional<uint64_t>(rs1)
: std::nullopt;
})
.value_or(std::nullopt);
}
Expand Down Expand Up @@ -612,7 +613,7 @@ static const InstrPattern PATTERNS[] = {
{"FMV_D_X", 0xFFF0707F, 0xF2000053, DecodeIType<FMV_D_X>},
};

Optional<DecodeResult> EmulateInstructionRISCV::Decode(uint32_t inst) {
std::optional<DecodeResult> EmulateInstructionRISCV::Decode(uint32_t inst) {
Log *log = GetLog(LLDBLog::Unwind);

uint16_t try_rvc = uint16_t(inst & 0x0000ffff);
Expand Down Expand Up @@ -1444,7 +1445,7 @@ class Executor {
}
bool operator()(FCLASS_S inst) { return FCLASS(inst, false); }
template <typename T, typename E>
bool FCVT_f2i(T inst, Optional<E> (Rs::*f)(EmulateInstructionRISCV &emu),
bool FCVT_f2i(T inst, std::optional<E> (Rs::*f)(EmulateInstructionRISCV &emu),
const fltSemantics &semantics) {
return transformOptional(((&inst.rs1)->*f)(m_emu),
[&](auto &&rs1) {
Expand Down Expand Up @@ -1605,7 +1606,8 @@ bool EmulateInstructionRISCV::EvaluateInstruction(uint32_t options) {
WritePC(*old_pc + Executor::size(m_decoded.is_rvc));
}

Optional<DecodeResult> EmulateInstructionRISCV::ReadInstructionAt(addr_t addr) {
std::optional<DecodeResult>
EmulateInstructionRISCV::ReadInstructionAt(addr_t addr) {
return transformOptional(ReadMem<uint32_t>(addr),
[&](uint32_t inst) { return Decode(inst); })
.value_or(std::nullopt);
Expand All @@ -1627,11 +1629,11 @@ bool EmulateInstructionRISCV::ReadInstruction() {
return true;
}

Optional<addr_t> EmulateInstructionRISCV::ReadPC() {
std::optional<addr_t> EmulateInstructionRISCV::ReadPC() {
bool success = false;
auto addr = ReadRegisterUnsigned(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC,
LLDB_INVALID_ADDRESS, &success);
return success ? Optional<addr_t>(addr) : std::nullopt;
return success ? std::optional<addr_t>(addr) : std::nullopt;
}

bool EmulateInstructionRISCV::WritePC(addr_t pc) {
Expand Down Expand Up @@ -1698,7 +1700,7 @@ bool EmulateInstructionRISCV::SetAccruedExceptions(
return WriteRegisterUnsigned(ctx, eRegisterKindLLDB, fpr_fcsr_riscv, fcsr);
}

Optional<RegisterInfo>
std::optional<RegisterInfo>
EmulateInstructionRISCV::GetRegisterInfo(RegisterKind reg_kind,
uint32_t reg_index) {
if (reg_kind == eRegisterKindGeneric) {
Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ class EmulateInstructionRISCV : public EmulateInstruction {
bool EvaluateInstruction(uint32_t options) override;
bool TestEmulation(Stream *out_stream, ArchSpec &arch,
OptionValueDictionary *test_data) override;
llvm::Optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;
std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
uint32_t reg_num) override;

llvm::Optional<lldb::addr_t> ReadPC();
std::optional<lldb::addr_t> ReadPC();
bool WritePC(lldb::addr_t pc);

llvm::Optional<DecodeResult> ReadInstructionAt(lldb::addr_t addr);
llvm::Optional<DecodeResult> Decode(uint32_t inst);
std::optional<DecodeResult> ReadInstructionAt(lldb::addr_t addr);
std::optional<DecodeResult> Decode(uint32_t inst);
bool Execute(DecodeResult inst, bool ignore_cond);

template <typename T>
std::enable_if_t<std::is_integral_v<T>, llvm::Optional<T>>
std::enable_if_t<std::is_integral_v<T>, std::optional<T>>
ReadMem(uint64_t addr) {
EmulateInstructionRISCV::Context ctx;
ctx.type = EmulateInstruction::eContextRegisterLoad;
Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ struct Rd {

struct Rs {
uint32_t rs;
llvm::Optional<uint64_t> Read(EmulateInstructionRISCV &emulator);
llvm::Optional<int32_t> ReadI32(EmulateInstructionRISCV &emulator);
llvm::Optional<int64_t> ReadI64(EmulateInstructionRISCV &emulator);
llvm::Optional<uint32_t> ReadU32(EmulateInstructionRISCV &emulator);
llvm::Optional<llvm::APFloat> ReadAPFloat(EmulateInstructionRISCV &emulator,
bool isDouble);
std::optional<uint64_t> Read(EmulateInstructionRISCV &emulator);
std::optional<int32_t> ReadI32(EmulateInstructionRISCV &emulator);
std::optional<int64_t> ReadI64(EmulateInstructionRISCV &emulator);
std::optional<uint32_t> ReadU32(EmulateInstructionRISCV &emulator);
std::optional<llvm::APFloat> ReadAPFloat(EmulateInstructionRISCV &emulator,
bool isDouble);
};

#define DERIVE_EQ(NAME) \
Expand Down
16 changes: 8 additions & 8 deletions lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ using ParsedFunction = lldb_private::CPlusPlusNameParser::ParsedFunction;
using ParsedName = lldb_private::CPlusPlusNameParser::ParsedName;
namespace tok = clang::tok;

Optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() {
std::optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() {
m_next_token_index = 0;
Optional<ParsedFunction> result(std::nullopt);
std::optional<ParsedFunction> result(std::nullopt);

// Try to parse the name as function without a return type specified e.g.
// main(int, char*[])
Expand All @@ -48,9 +48,9 @@ Optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() {
return result;
}

Optional<ParsedName> CPlusPlusNameParser::ParseAsFullName() {
std::optional<ParsedName> CPlusPlusNameParser::ParseAsFullName() {
m_next_token_index = 0;
Optional<ParsedNameRanges> name_ranges = ParseFullNameImpl();
std::optional<ParsedNameRanges> name_ranges = ParseFullNameImpl();
if (!name_ranges)
return std::nullopt;
if (HasMoreTokens())
Expand Down Expand Up @@ -102,7 +102,7 @@ clang::Token &CPlusPlusNameParser::Peek() {
return m_tokens[m_next_token_index];
}

Optional<ParsedFunction>
std::optional<ParsedFunction>
CPlusPlusNameParser::ParseFunctionImpl(bool expect_return_type) {
Bookmark start_position = SetBookmark();

Expand Down Expand Up @@ -139,7 +139,7 @@ CPlusPlusNameParser::ParseFunctionImpl(bool expect_return_type) {
return result;
}

Optional<ParsedFunction>
std::optional<ParsedFunction>
CPlusPlusNameParser::ParseFuncPtr(bool expect_return_type) {
// This function parses a function definition
// that returns a pointer type.
Expand Down Expand Up @@ -569,7 +569,7 @@ bool CPlusPlusNameParser::ConsumeTypename() {
return true;
}

Optional<CPlusPlusNameParser::ParsedNameRanges>
std::optional<CPlusPlusNameParser::ParsedNameRanges>
CPlusPlusNameParser::ParseFullNameImpl() {
// Name parsing state machine.
enum class State {
Expand All @@ -583,7 +583,7 @@ CPlusPlusNameParser::ParseFullNameImpl() {
Bookmark start_position = SetBookmark();
State state = State::Beginning;
bool continue_parsing = true;
Optional<size_t> last_coloncolon_position;
std::optional<size_t> last_coloncolon_position;

while (continue_parsing && HasMoreTokens()) {
const auto &token = Peek();
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CPlusPlusNameParser {
// std::vector<int>::push_back(int)
// int& map<int, pair<short, int>>::operator[](short) const
// int (*get_function(const chat *))()
llvm::Optional<ParsedFunction> ParseAsFunctionDefinition();
std::optional<ParsedFunction> ParseAsFunctionDefinition();

// Treats given text as a potentially nested name of C++ entity (function,
// class, field) and parses it.
Expand All @@ -56,7 +56,7 @@ class CPlusPlusNameParser {
// std::vector<int>::push_back
// map<int, pair<short, int>>::operator[]
// func<C>(int, C&)::nested_class::method
llvm::Optional<ParsedName> ParseAsFullName();
std::optional<ParsedName> ParseAsFullName();

private:
// A C++ definition to parse.
Expand Down Expand Up @@ -126,10 +126,10 @@ class CPlusPlusNameParser {
clang::Token &Peek();
bool ConsumeBrackets(clang::tok::TokenKind left, clang::tok::TokenKind right);

llvm::Optional<ParsedFunction> ParseFunctionImpl(bool expect_return_type);
std::optional<ParsedFunction> ParseFunctionImpl(bool expect_return_type);

// Parses functions returning function pointers 'string (*f(int x))(float y)'
llvm::Optional<ParsedFunction> ParseFuncPtr(bool expect_return_type);
std::optional<ParsedFunction> ParseFuncPtr(bool expect_return_type);

// Consumes function arguments enclosed within '(' ... ')'
bool ConsumeArguments();
Expand Down Expand Up @@ -177,7 +177,7 @@ class CPlusPlusNameParser {
/// [A-Za-z,.\s\d]+
bool ConsumeAbiTag();

llvm::Optional<ParsedNameRanges> ParseFullNameImpl();
std::optional<ParsedNameRanges> ParseFullNameImpl();
llvm::StringRef GetTextForRange(const Range &range);

// Populate m_tokens by calling clang lexer on m_text.
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool lldb_private::formatters::WCharStringSummaryProvider(
return false;

// Safe to pass nullptr for exe_scope here.
llvm::Optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr);
std::optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr);
if (!size)
return false;
const uint32_t wchar_size = *size;
Expand Down Expand Up @@ -184,7 +184,7 @@ bool lldb_private::formatters::WCharSummaryProvider(
return false;

// Safe to pass nullptr for exe_scope here.
llvm::Optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr);
std::optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr);
if (!size)
return false;
const uint32_t wchar_size = *size;
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ ValueObjectSP GenericBitsetFrontEnd::GetChildAtIndex(size_t idx) {
ValueObjectSP chunk;
// For small bitsets __first_ is not an array, but a plain size_t.
if (m_first->GetCompilerType().IsArrayType(&type)) {
llvm::Optional<uint64_t> bit_size =
std::optional<uint64_t> bit_size =
type.GetBitSize(ctx.GetBestExecutionContextScope());
if (!bit_size || *bit_size == 0)
return {};
Expand All @@ -119,7 +119,7 @@ ValueObjectSP GenericBitsetFrontEnd::GetChildAtIndex(size_t idx) {
if (!type || !chunk)
return {};

llvm::Optional<uint64_t> bit_size =
std::optional<uint64_t> bit_size =
type.GetBitSize(ctx.GetBestExecutionContextScope());
if (!bit_size || *bit_size == 0)
return {};
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
{"cw", ast_ctx->GetBasicType(lldb::eBasicTypeBool)},
{"payload", pair_type}});
llvm::Optional<uint64_t> size = tree_node_type.GetByteSize(nullptr);
std::optional<uint64_t> size = tree_node_type.GetByteSize(nullptr);
if (!size)
return false;
WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0));
Expand Down Expand Up @@ -484,7 +484,7 @@ bool lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
{"__hash_", ast_ctx->GetBasicType(lldb::eBasicTypeUnsignedLongLong)},
{"__value_", pair_type}});
llvm::Optional<uint64_t> size = tree_node_type.GetByteSize(nullptr);
std::optional<uint64_t> size = tree_node_type.GetByteSize(nullptr);
if (!size)
return false;
WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0));
Expand Down Expand Up @@ -730,7 +730,7 @@ enum class StringLayout { CSD, DSC };
/// Determine the size in bytes of \p valobj (a libc++ std::string object) and
/// extract its data payload. Return the size + payload pair.
// TODO: Support big-endian architectures.
static llvm::Optional<std::pair<uint64_t, ValueObjectSP>>
static std::optional<std::pair<uint64_t, ValueObjectSP>>
ExtractLibcxxStringInfo(ValueObject &valobj) {
ValueObjectSP valobj_r_sp =
valobj.GetChildMemberWithName(ConstString("__r_"), /*can_create=*/true);
Expand Down Expand Up @@ -799,7 +799,7 @@ ExtractLibcxxStringInfo(ValueObject &valobj) {
// inline string buffer (23 bytes on x86_64/Darwin). If it doesn't, it's
// likely that the string isn't initialized and we're reading garbage.
ExecutionContext exe_ctx(location_sp->GetExecutionContextRef());
const llvm::Optional<uint64_t> max_bytes =
const std::optional<uint64_t> max_bytes =
location_sp->GetCompilerType().GetByteSize(
exe_ctx.GetBestExecutionContextScope());
if (!max_bytes || size > *max_bytes || !location_sp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
if (!m_element_type.IsValid())
return false;

if (llvm::Optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
m_element_size = *size;
// Store raw pointers or end up with a circular dependency.
m_start = m_backend.GetChildMemberWithName(g_begin_, true).get();
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ bool lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::Update() {
m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType();

// Get element size.
if (llvm::Optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
m_element_size = *size;

// Get data.
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ LibcxxVariantGetIndexValidity(ValueObjectSP &impl_sp) {
// the byte size.
CompilerType index_type = index_sp->GetCompilerType();

llvm::Optional<uint64_t> index_type_bytes = index_type.GetByteSize(nullptr);
std::optional<uint64_t> index_type_bytes = index_type.GetByteSize(nullptr);
if (!index_type_bytes)
return LibcxxVariantIndexValidity::Invalid;

Expand All @@ -112,7 +112,7 @@ LibcxxVariantGetIndexValidity(ValueObjectSP &impl_sp) {
return LibcxxVariantIndexValidity::Valid;
}

llvm::Optional<uint64_t> LibcxxVariantIndexValue(ValueObjectSP &impl_sp) {
std::optional<uint64_t> LibcxxVariantIndexValue(ValueObjectSP &impl_sp) {
ValueObjectSP index_sp(
impl_sp->GetChildMemberWithName(ConstString("__index"), true));

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
if (!data_type_finder_sp)
return false;
m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType();
if (llvm::Optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
m_element_size = *size;

if (m_element_size > 0) {
Expand Down Expand Up @@ -212,7 +212,7 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex(
return {};
mask = 1 << bit_index;
bool bit_set = ((byte & mask) != 0);
llvm::Optional<uint64_t> size = m_bool_type.GetByteSize(nullptr);
std::optional<uint64_t> size = m_bool_type.GetByteSize(nullptr);
if (!size)
return {};
WritableDataBufferSP buffer_sp(new DataBufferHeap(*size, 0));
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ bool lldb_private::formatters::LibStdcppWStringSummaryProvider(
return false;

// Safe to pass nullptr for exe_scope here.
llvm::Optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr);
std::optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr);
if (!size)
return false;
const uint32_t wchar_size = *size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ determineClangStyle(const ClangHighlighter &highlighter,

void ClangHighlighter::Highlight(const HighlightStyle &options,
llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines,
Stream &result) const {
using namespace clang;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ClangHighlighter : public Highlighter {
llvm::StringRef GetName() const override { return "clang"; }

void Highlight(const HighlightStyle &options, llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines, Stream &s) const override;

/// Returns true if the given string represents a keywords in any Clang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
lldb::ModuleWP m_objc_module_wp;
std::unique_ptr<FunctionCaller> m_print_object_caller_up;

llvm::Optional<uint32_t> m_Foundation_major;
std::optional<uint32_t> m_Foundation_major;
};

} // namespace lldb_private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime {
EncodingToTypeSP m_encoding_to_type_sp;
std::once_flag m_no_classes_cached_warning;
std::once_flag m_no_expanded_cache_warning;
llvm::Optional<std::pair<lldb::addr_t, lldb::addr_t>> m_CFBoolean_values;
std::optional<std::pair<lldb::addr_t, lldb::addr_t>> m_CFBoolean_values;
uint64_t m_realized_class_generation_count;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ Status ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition(
return error;
}

llvm::Optional<CompilerType>
std::optional<CompilerType>
ObjCLanguageRuntime::GetRuntimeType(CompilerType base_type) {
CompilerType class_type;
bool is_pointer_type = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class ObjCLanguageRuntime : public LanguageRuntime {

lldb::TypeSP LookupInCompleteClassCache(ConstString &name);

llvm::Optional<CompilerType> GetRuntimeType(CompilerType base_type) override;
std::optional<CompilerType> GetRuntimeType(CompilerType base_type) override;

virtual llvm::Expected<std::unique_ptr<UtilityFunction>>
CreateObjectChecker(std::string name, ExecutionContext &exe_ctx) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static uint32_t MachHeaderSizeFromMagic(uint32_t magic) {
}
}

static llvm::Optional<mach_header> ParseMachOHeader(DataExtractor &data) {
static std::optional<mach_header> ParseMachOHeader(DataExtractor &data) {
lldb::offset_t offset = 0;
mach_header header;
header.magic = data.GetU32(&offset);
Expand Down Expand Up @@ -136,7 +136,7 @@ static llvm::Optional<mach_header> ParseMachOHeader(DataExtractor &data) {
static bool
ParseFileset(DataExtractor &data, mach_header header,
std::vector<ObjectContainerMachOFileset::Entry> &entries,
llvm::Optional<lldb::addr_t> load_addr = std::nullopt) {
std::optional<lldb::addr_t> load_addr = std::nullopt) {
lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
lldb::offset_t slide = 0;
for (uint32_t i = 0; i < header.ncmds; ++i) {
Expand Down Expand Up @@ -173,7 +173,7 @@ ParseFileset(DataExtractor &data, mach_header header,
bool ObjectContainerMachOFileset::ParseHeader(
DataExtractor &data, const lldb_private::FileSpec &file,
lldb::offset_t file_offset, std::vector<Entry> &entries) {
llvm::Optional<mach_header> header = ParseMachOHeader(data);
std::optional<mach_header> header = ParseMachOHeader(data);

if (!header)
return false;
Expand All @@ -197,7 +197,7 @@ bool ObjectContainerMachOFileset::ParseHeader() {

std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());

llvm::Optional<mach_header> header = ParseMachOHeader(m_data);
std::optional<mach_header> header = ParseMachOHeader(m_data);
if (!header)
return false;

Expand Down
27 changes: 13 additions & 14 deletions lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static UUID parseModuleId(llvm::Triple::OSType os, llvm::StringRef str) {
: sizeof(data.uuid));
}

llvm::Optional<Record::Kind> Record::classify(llvm::StringRef Line) {
std::optional<Record::Kind> Record::classify(llvm::StringRef Line) {
Token Tok = consume<Token>(Line);
switch (Tok) {
case Token::Module:
Expand Down Expand Up @@ -170,7 +170,7 @@ llvm::Optional<Record::Kind> Record::classify(llvm::StringRef Line) {
llvm_unreachable("Fully covered switch above!");
}

llvm::Optional<ModuleRecord> ModuleRecord::parse(llvm::StringRef Line) {
std::optional<ModuleRecord> ModuleRecord::parse(llvm::StringRef Line) {
// MODULE Linux x86_64 E5894855C35DCCCCCCCCCCCCCCCCCCCC0 a.out
if (consume<Token>(Line) != Token::Module)
return std::nullopt;
Expand Down Expand Up @@ -199,7 +199,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
<< R.ID.GetAsString();
}

llvm::Optional<InfoRecord> InfoRecord::parse(llvm::StringRef Line) {
std::optional<InfoRecord> InfoRecord::parse(llvm::StringRef Line) {
// INFO CODE_ID 554889E55DC3CCCCCCCCCCCCCCCCCCCC [a.exe]
if (consume<Token>(Line) != Token::Info)
return std::nullopt;
Expand All @@ -225,8 +225,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
}

template <typename T>
static llvm::Optional<T> parseNumberName(llvm::StringRef Line,
Token TokenType) {
static std::optional<T> parseNumberName(llvm::StringRef Line, Token TokenType) {
// TOKEN number name
if (consume<Token>(Line) != TokenType)
return std::nullopt;
Expand All @@ -244,7 +243,7 @@ static llvm::Optional<T> parseNumberName(llvm::StringRef Line,
return T(Number, Name);
}

llvm::Optional<FileRecord> FileRecord::parse(llvm::StringRef Line) {
std::optional<FileRecord> FileRecord::parse(llvm::StringRef Line) {
// FILE number name
return parseNumberName<FileRecord>(Line, Token::File);
}
Expand All @@ -254,7 +253,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
return OS << "FILE " << R.Number << " " << R.Name;
}

llvm::Optional<InlineOriginRecord>
std::optional<InlineOriginRecord>
InlineOriginRecord::parse(llvm::StringRef Line) {
// INLINE_ORIGIN number name
return parseNumberName<InlineOriginRecord>(Line, Token::InlineOrigin);
Expand Down Expand Up @@ -303,7 +302,7 @@ static bool parsePublicOrFunc(llvm::StringRef Line, bool &Multiple,
return true;
}

llvm::Optional<FuncRecord> FuncRecord::parse(llvm::StringRef Line) {
std::optional<FuncRecord> FuncRecord::parse(llvm::StringRef Line) {
bool Multiple;
lldb::addr_t Address, Size, ParamSize;
llvm::StringRef Name;
Expand All @@ -325,7 +324,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
R.ParamSize, R.Name);
}

llvm::Optional<InlineRecord> InlineRecord::parse(llvm::StringRef Line) {
std::optional<InlineRecord> InlineRecord::parse(llvm::StringRef Line) {
// INLINE inline_nest_level call_site_line call_site_file_num origin_num
// [address size]+
if (consume<Token>(Line) != Token::Inline)
Expand Down Expand Up @@ -377,7 +376,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
return OS;
}

llvm::Optional<LineRecord> LineRecord::parse(llvm::StringRef Line) {
std::optional<LineRecord> LineRecord::parse(llvm::StringRef Line) {
lldb::addr_t Address;
llvm::StringRef Str;
std::tie(Str, Line) = getToken(Line);
Expand Down Expand Up @@ -412,7 +411,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
R.LineNum, R.FileNum);
}

llvm::Optional<PublicRecord> PublicRecord::parse(llvm::StringRef Line) {
std::optional<PublicRecord> PublicRecord::parse(llvm::StringRef Line) {
bool Multiple;
lldb::addr_t Address, ParamSize;
llvm::StringRef Name;
Expand All @@ -434,7 +433,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
R.Name);
}

llvm::Optional<StackCFIRecord> StackCFIRecord::parse(llvm::StringRef Line) {
std::optional<StackCFIRecord> StackCFIRecord::parse(llvm::StringRef Line) {
// STACK CFI INIT address size reg1: expr1 reg2: expr2 ...
// or
// STACK CFI address reg1: expr1 reg2: expr2 ...
Expand All @@ -456,7 +455,7 @@ llvm::Optional<StackCFIRecord> StackCFIRecord::parse(llvm::StringRef Line) {
if (!to_integer(Str, Address, 16))
return std::nullopt;

llvm::Optional<lldb::addr_t> Size;
std::optional<lldb::addr_t> Size;
if (IsInitRecord) {
Size.emplace();
std::tie(Str, Line) = getToken(Line);
Expand All @@ -483,7 +482,7 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
return OS << " " << R.UnwindRules;
}

llvm::Optional<StackWinRecord> StackWinRecord::parse(llvm::StringRef Line) {
std::optional<StackWinRecord> StackWinRecord::parse(llvm::StringRef Line) {
// STACK WIN type rva code_size prologue_size epilogue_size parameter_size
// saved_register_size local_size max_stack_size has_program_string
// program_string_OR_allocates_base_pointer
Expand Down
26 changes: 13 additions & 13 deletions lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Record {
/// Attempt to guess the kind of the record present in the argument without
/// doing a full parse. The returned kind will always be correct for valid
/// records, but the full parse can still fail in case of corrupted input.
static llvm::Optional<Kind> classify(llvm::StringRef Line);
static std::optional<Kind> classify(llvm::StringRef Line);

protected:
Record(Kind K) : TheKind(K) {}
Expand All @@ -59,7 +59,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, Record::Kind K) {

class ModuleRecord : public Record {
public:
static llvm::Optional<ModuleRecord> parse(llvm::StringRef Line);
static std::optional<ModuleRecord> parse(llvm::StringRef Line);
ModuleRecord(llvm::Triple::OSType OS, llvm::Triple::ArchType Arch, UUID ID)
: Record(Module), OS(OS), Arch(Arch), ID(std::move(ID)) {}

Expand All @@ -75,7 +75,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const ModuleRecord &R);

class InfoRecord : public Record {
public:
static llvm::Optional<InfoRecord> parse(llvm::StringRef Line);
static std::optional<InfoRecord> parse(llvm::StringRef Line);
InfoRecord(UUID ID) : Record(Info), ID(std::move(ID)) {}

UUID ID;
Expand All @@ -88,7 +88,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const InfoRecord &R);

class FileRecord : public Record {
public:
static llvm::Optional<FileRecord> parse(llvm::StringRef Line);
static std::optional<FileRecord> parse(llvm::StringRef Line);
FileRecord(size_t Number, llvm::StringRef Name)
: Record(File), Number(Number), Name(Name) {}

Expand All @@ -103,7 +103,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const FileRecord &R);

class InlineOriginRecord : public Record {
public:
static llvm::Optional<InlineOriginRecord> parse(llvm::StringRef Line);
static std::optional<InlineOriginRecord> parse(llvm::StringRef Line);
InlineOriginRecord(size_t Number, llvm::StringRef Name)
: Record(InlineOrigin), Number(Number), Name(Name) {}

Expand All @@ -120,7 +120,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,

class FuncRecord : public Record {
public:
static llvm::Optional<FuncRecord> parse(llvm::StringRef Line);
static std::optional<FuncRecord> parse(llvm::StringRef Line);
FuncRecord(bool Multiple, lldb::addr_t Address, lldb::addr_t Size,
lldb::addr_t ParamSize, llvm::StringRef Name)
: Record(Module), Multiple(Multiple), Address(Address), Size(Size),
Expand All @@ -138,7 +138,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const FuncRecord &R);

class InlineRecord : public Record {
public:
static llvm::Optional<InlineRecord> parse(llvm::StringRef Line);
static std::optional<InlineRecord> parse(llvm::StringRef Line);
InlineRecord(size_t InlineNestLevel, uint32_t CallSiteLineNum,
size_t CallSiteFileNum, size_t OriginNum)
: Record(Inline), InlineNestLevel(InlineNestLevel),
Expand All @@ -158,7 +158,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const InlineRecord &R);

class LineRecord : public Record {
public:
static llvm::Optional<LineRecord> parse(llvm::StringRef Line);
static std::optional<LineRecord> parse(llvm::StringRef Line);
LineRecord(lldb::addr_t Address, lldb::addr_t Size, uint32_t LineNum,
size_t FileNum)
: Record(Line), Address(Address), Size(Size), LineNum(LineNum),
Expand All @@ -175,7 +175,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const LineRecord &R);

class PublicRecord : public Record {
public:
static llvm::Optional<PublicRecord> parse(llvm::StringRef Line);
static std::optional<PublicRecord> parse(llvm::StringRef Line);
PublicRecord(bool Multiple, lldb::addr_t Address, lldb::addr_t ParamSize,
llvm::StringRef Name)
: Record(Module), Multiple(Multiple), Address(Address),
Expand All @@ -192,14 +192,14 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const PublicRecord &R);

class StackCFIRecord : public Record {
public:
static llvm::Optional<StackCFIRecord> parse(llvm::StringRef Line);
StackCFIRecord(lldb::addr_t Address, llvm::Optional<lldb::addr_t> Size,
static std::optional<StackCFIRecord> parse(llvm::StringRef Line);
StackCFIRecord(lldb::addr_t Address, std::optional<lldb::addr_t> Size,
llvm::StringRef UnwindRules)
: Record(StackCFI), Address(Address), Size(Size),
UnwindRules(UnwindRules) {}

lldb::addr_t Address;
llvm::Optional<lldb::addr_t> Size;
std::optional<lldb::addr_t> Size;
llvm::StringRef UnwindRules;
};

Expand All @@ -208,7 +208,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const StackCFIRecord &R);

class StackWinRecord : public Record {
public:
static llvm::Optional<StackWinRecord> parse(llvm::StringRef Line);
static std::optional<StackWinRecord> parse(llvm::StringRef Line);

StackWinRecord(lldb::addr_t RVA, lldb::addr_t CodeSize,
lldb::addr_t ParameterSize, lldb::addr_t SavedRegisterSize,
Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ namespace {
struct Header {
ArchSpec arch;
UUID uuid;
static llvm::Optional<Header> parse(llvm::StringRef text);
static std::optional<Header> parse(llvm::StringRef text);
};
} // namespace

llvm::Optional<Header> Header::parse(llvm::StringRef text) {
std::optional<Header> Header::parse(llvm::StringRef text) {
llvm::StringRef line;
std::tie(line, text) = text.split('\n');
auto Module = ModuleRecord::parse(line);
Expand Down Expand Up @@ -67,7 +67,7 @@ ObjectFile *ObjectFileBreakpad::CreateInstance(
data_offset = 0;
}
auto text = toStringRef(data_sp->GetData());
llvm::Optional<Header> header = Header::parse(text);
std::optional<Header> header = Header::parse(text);
if (!header)
return nullptr;

Expand All @@ -94,7 +94,7 @@ size_t ObjectFileBreakpad::GetModuleSpecifications(
const FileSpec &file, DataBufferSP &data_sp, offset_t data_offset,
offset_t file_offset, offset_t length, ModuleSpecList &specs) {
auto text = toStringRef(data_sp->GetData());
llvm::Optional<Header> header = Header::parse(text);
std::optional<Header> header = Header::parse(text);
if (!header)
return 0;
ModuleSpec spec(file, std::move(header->arch));
Expand Down Expand Up @@ -128,7 +128,7 @@ void ObjectFileBreakpad::CreateSections(SectionList &unified_section_list) {
return;
m_sections_up = std::make_unique<SectionList>();

llvm::Optional<Record::Kind> current_section;
std::optional<Record::Kind> current_section;
offset_t section_start;
llvm::StringRef text = toStringRef(m_data.GetData());
uint32_t next_section_id = 1;
Expand All @@ -149,7 +149,7 @@ void ObjectFileBreakpad::CreateSections(SectionList &unified_section_list) {
llvm::StringRef line;
std::tie(line, text) = text.split('\n');

llvm::Optional<Record::Kind> next_section = Record::classify(line);
std::optional<Record::Kind> next_section = Record::classify(line);
if (next_section == Record::Line || next_section == Record::Inline) {
// Line/Inline records logically belong to the preceding Func record, so
// we put them in the same section.
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ UUID ObjectFileELF::GetUUID() {
return m_uuid;
}

llvm::Optional<FileSpec> ObjectFileELF::GetDebugLink() {
std::optional<FileSpec> ObjectFileELF::GetDebugLink() {
if (m_gnu_debuglink_file.empty())
return std::nullopt;
return FileSpec(m_gnu_debuglink_file);
Expand Down Expand Up @@ -1767,7 +1767,7 @@ class VMAddressProvider {
return llvm::formatv("{0}[{1}]", SegmentName, SegmentCount).str();
}

llvm::Optional<VMRange> GetAddressInfo(const ELFProgramHeader &H) {
std::optional<VMRange> GetAddressInfo(const ELFProgramHeader &H) {
if (H.p_memsz == 0) {
LLDB_LOG(Log, "Ignoring zero-sized {0} segment. Corrupt object file?",
SegmentName);
Expand All @@ -1782,7 +1782,7 @@ class VMAddressProvider {
return VMRange(H.p_vaddr, H.p_memsz);
}

llvm::Optional<SectionAddressInfo> GetAddressInfo(const ELFSectionHeader &H) {
std::optional<SectionAddressInfo> GetAddressInfo(const ELFSectionHeader &H) {
VMRange Range = GetVMRange(H);
SectionSP Segment;
auto It = Segments.find(Range.GetRangeBase());
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ObjectFileELF : public lldb_private::ObjectFile {

/// Return the contents of the .gnu_debuglink section, if the object file
/// contains it.
llvm::Optional<lldb_private::FileSpec> GetDebugLink();
std::optional<lldb_private::FileSpec> GetDebugLink();

uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;

Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2201,7 +2201,7 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache,
return dsc_uuid;
}

static llvm::Optional<struct nlist_64>
static std::optional<struct nlist_64>
ParseNList(DataExtractor &nlist_data, lldb::offset_t &nlist_data_offset,
size_t nlist_byte_size) {
struct nlist_64 nlist;
Expand Down Expand Up @@ -2807,7 +2807,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
nlist_index++) {
/////////////////////////////
{
llvm::Optional<struct nlist_64> nlist_maybe =
std::optional<struct nlist_64> nlist_maybe =
ParseNList(dsc_local_symbols_data, nlist_data_offset,
nlist_byte_size);
if (!nlist_maybe)
Expand Down Expand Up @@ -6537,7 +6537,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,

if (prot != 0 && include_this_region) {
addr_t pagesize = range_info.GetPageSize();
const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
const std::optional<std::vector<addr_t>> &dirty_page_list =
range_info.GetDirtyPageList();
if (dirty_pages_only && dirty_page_list) {
for (addr_t dirtypage : *dirty_page_list) {
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ class ObjectFileMachO : public lldb_private::ObjectFile {
llvm::MachO::dysymtab_command m_dysymtab;
std::vector<llvm::MachO::segment_command_64> m_mach_segments;
std::vector<llvm::MachO::section_64> m_mach_sections;
llvm::Optional<llvm::VersionTuple> m_min_os_version;
llvm::Optional<llvm::VersionTuple> m_sdk_versions;
std::optional<llvm::VersionTuple> m_min_os_version;
std::optional<llvm::VersionTuple> m_sdk_versions;
typedef lldb_private::RangeVector<uint32_t, uint32_t> FileRangeArray;
lldb_private::Address m_entry_point_address;
FileRangeArray m_thread_context_offsets;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ UUID ObjectFilePECOFF::GetUUID() {
return m_uuid;
}

llvm::Optional<FileSpec> ObjectFilePECOFF::GetDebugLink() {
std::optional<FileSpec> ObjectFilePECOFF::GetDebugLink() {
std::string gnu_debuglink_file;
uint32_t gnu_debuglink_crc;
if (GetDebugLinkContents(*m_binary, gnu_debuglink_file, gnu_debuglink_crc))
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ObjectFilePECOFF : public lldb_private::ObjectFile {

/// Return the contents of the .gnu_debuglink section, if the object file
/// contains it.
llvm::Optional<lldb_private::FileSpec> GetDebugLink();
std::optional<lldb_private::FileSpec> GetDebugLink();

uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;

Expand Down Expand Up @@ -282,7 +282,7 @@ class ObjectFilePECOFF : public lldb_private::ObjectFile {
SectionHeaderColl m_sect_headers;
lldb::addr_t m_image_base;
lldb_private::Address m_entry_point_address;
llvm::Optional<lldb_private::FileSpecList> m_deps_filespec;
std::optional<lldb_private::FileSpecList> m_deps_filespec;
std::unique_ptr<llvm::object::COFFObjectFile> m_binary;
lldb_private::UUID m_uuid;
};
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static bool ValidateModuleHeader(const DataBufferSP &data_sp) {
return version == llvm::wasm::WasmVersion;
}

static llvm::Optional<ConstString>
static std::optional<ConstString>
GetWasmString(llvm::DataExtractor &data, llvm::DataExtractor::Cursor &c) {
// A Wasm string is encoded as a vector of UTF-8 codes.
// Vectors are encoded with their u32 length followed by the element
Expand Down Expand Up @@ -182,7 +182,7 @@ bool ObjectFileWasm::DecodeNextSection(lldb::offset_t *offset_ptr) {
// identifying the custom section, followed by an uninterpreted sequence
// of bytes.
lldb::offset_t prev_offset = c.tell();
llvm::Optional<ConstString> sect_name = GetWasmString(data, c);
std::optional<ConstString> sect_name = GetWasmString(data, c);
if (!sect_name)
return false;

Expand Down Expand Up @@ -413,7 +413,7 @@ DataExtractor ObjectFileWasm::ReadImageData(offset_t offset, uint32_t size) {
return data;
}

llvm::Optional<FileSpec> ObjectFileWasm::GetExternalDebugInfoFileSpec() {
std::optional<FileSpec> ObjectFileWasm::GetExternalDebugInfoFileSpec() {
static ConstString g_sect_name_external_debug_info("external_debug_info");

for (const section_info &sect_info : m_sect_infos) {
Expand All @@ -423,7 +423,7 @@ llvm::Optional<FileSpec> ObjectFileWasm::GetExternalDebugInfoFileSpec() {
ReadImageData(sect_info.offset, kBufferSize);
llvm::DataExtractor data = section_header_data.GetAsLLVM();
llvm::DataExtractor::Cursor c(0);
llvm::Optional<ConstString> symbols_url = GetWasmString(data, c);
std::optional<ConstString> symbols_url = GetWasmString(data, c);
if (symbols_url)
return FileSpec(symbols_url->GetStringRef());
}
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ObjectFileWasm : public ObjectFile {
/// custom section named "external_debug_info", whose payload is an UTF-8
/// encoded string that points to a Wasm module that contains the debug
/// information for this module.
llvm::Optional<FileSpec> GetExternalDebugInfoFileSpec();
std::optional<FileSpec> GetExternalDebugInfoFileSpec();

private:
ObjectFileWasm(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Status PlatformAndroid::ConnectRemote(Args &args) {
const char *url = args.GetArgumentAtIndex(0);
if (!url)
return Status("URL is null.");
llvm::Optional<URI> parsed_url = URI::Parse(url);
std::optional<URI> parsed_url = URI::Parse(url);
if (!parsed_url)
return Status("Invalid URL: %s", url);
if (parsed_url->hostname != "localhost")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static const lldb::pid_t g_remote_platform_pid =
static Status ForwardPortWithAdb(
const uint16_t local_port, const uint16_t remote_port,
llvm::StringRef remote_socket_name,
const llvm::Optional<AdbClient::UnixSocketNamespace> &socket_namespace,
const std::optional<AdbClient::UnixSocketNamespace> &socket_namespace,
std::string &device_id) {
Log *log = GetLog(LLDBLog::Platform);

Expand Down Expand Up @@ -120,7 +120,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {
const char *url = args.GetArgumentAtIndex(0);
if (!url)
return Status("URL is null.");
llvm::Optional<URI> parsed_url = URI::Parse(url);
std::optional<URI> parsed_url = URI::Parse(url);
if (!parsed_url)
return Status("Invalid URL: %s", url);
if (parsed_url->hostname != "localhost")
Expand Down Expand Up @@ -229,7 +229,7 @@ lldb::ProcessSP PlatformAndroidRemoteGDBServer::ConnectProcess(
// any other valid pid on android.
static lldb::pid_t s_remote_gdbserver_fake_pid = 0xffffffffffffffffULL;

llvm::Optional<URI> parsed_url = URI::Parse(connect_url);
std::optional<URI> parsed_url = URI::Parse(connect_url);
if (!parsed_url) {
error.SetErrorStringWithFormat("Invalid URL: %s",
connect_url.str().c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PlatformAndroidRemoteGDBServer
protected:
std::string m_device_id;
std::map<lldb::pid_t, uint16_t> m_port_forwards;
llvm::Optional<AdbClient::UnixSocketNamespace> m_socket_namespace;
std::optional<AdbClient::UnixSocketNamespace> m_socket_namespace;

bool LaunchGDBServer(lldb::pid_t &pid, std::string &connect_url) override;

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class PlatformAppleSimulator : public PlatformDarwin {
const char *m_description;
ConstString m_plugin_name;
std::mutex m_core_sim_path_mutex;
llvm::Optional<FileSpec> m_core_simulator_framework_path;
llvm::Optional<CoreSimulatorSupport::Device> m_device;
std::optional<FileSpec> m_core_simulator_framework_path;
std::optional<CoreSimulatorSupport::Device> m_device;
CoreSimulatorSupport::DeviceType::ProductFamilyID m_kind;

FileSpec GetCoreSimulatorPath();
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ static llvm::ArrayRef<const char *> GetCompatibleArchs(ArchSpec::Core core) {
/// distinct names (e.g. armv7f) but armv7 binaries run fine on an armv7f
/// processor.
void PlatformDarwin::ARMGetSupportedArchitectures(
std::vector<ArchSpec> &archs, llvm::Optional<llvm::Triple::OSType> os) {
std::vector<ArchSpec> &archs, std::optional<llvm::Triple::OSType> os) {
const ArchSpec system_arch = GetSystemArchitecture();
const ArchSpec::Core system_core = system_arch.GetCore();
for (const char *arch : GetCompatibleArchs(system_core)) {
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class PlatformDarwin : public PlatformPOSIX {

void
ARMGetSupportedArchitectures(std::vector<ArchSpec> &archs,
llvm::Optional<llvm::Triple::OSType> os = {});
std::optional<llvm::Triple::OSType> os = {});

void x86GetSupportedArchitectures(std::vector<ArchSpec> &archs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ PlatformDarwinDevice::GetSDKDirectoryForCurrentOSVersion() {

// Fall back to the platform's build string.
if (!build) {
if (llvm::Optional<std::string> os_build_str = GetOSBuildString()) {
if (std::optional<std::string> os_build_str = GetOSBuildString()) {
build = ConstString(*os_build_str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Status PlatformRemoteDarwinDevice::GetSharedModule(
uint32_t PlatformRemoteDarwinDevice::GetConnectedSDKIndex() {
if (IsConnected()) {
if (m_connected_module_sdk_idx == UINT32_MAX) {
if (llvm::Optional<std::string> build = GetRemoteOSBuildString()) {
if (std::optional<std::string> build = GetRemoteOSBuildString()) {
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
for (uint32_t i = 0; i < num_sdk_infos; ++i) {
const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class DeviceType {

private:
id m_dev = nullptr;
llvm::Optional<ModelIdentifier> m_model_identifier;
std::optional<ModelIdentifier> m_model_identifier;
};

class OSVersion {
Expand Down Expand Up @@ -131,7 +131,7 @@ class DeviceRuntime {

private:
id m_dev = nullptr;
llvm::Optional<OSVersion> m_os_version;
std::optional<OSVersion> m_os_version;
};

class Device {
Expand Down Expand Up @@ -171,8 +171,8 @@ class Device {

private:
id m_dev = nullptr;
llvm::Optional<DeviceType> m_dev_type;
llvm::Optional<DeviceRuntime> m_dev_runtime;
std::optional<DeviceType> m_dev_type;
std::optional<DeviceRuntime> m_dev_runtime;

friend class DeviceSet;
};
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,14 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
// This will be the address of the storage for paths, if we are using them,
// or nullptr to signal we aren't.
lldb::addr_t path_array_addr = 0x0;
llvm::Optional<llvm::detail::scope_exit<std::function<void()>>>
std::optional<llvm::detail::scope_exit<std::function<void()>>>
path_array_cleanup;

// This is the address to a buffer large enough to hold the largest path
// conjoined with the library name we're passing in. This is a convenience
// to avoid having to call malloc in the dlopen function.
lldb::addr_t buffer_addr = 0x0;
llvm::Optional<llvm::detail::scope_exit<std::function<void()>>>
buffer_cleanup;
std::optional<llvm::detail::scope_exit<std::function<void()>>> buffer_cleanup;

// Set the values into our args and write them to the target:
if (paths != nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,

/* Inject paths parameter into inferior */
lldb::addr_t injected_paths{0x0};
llvm::Optional<llvm::detail::scope_exit<std::function<void()>>> paths_cleanup;
std::optional<llvm::detail::scope_exit<std::function<void()>>> paths_cleanup;
if (paths) {
llvm::SmallVector<llvm::UTF16, 261> search_paths;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ bool PlatformRemoteGDBServer::GetRemoteOSVersion() {
return !m_os_version.empty();
}

llvm::Optional<std::string> PlatformRemoteGDBServer::GetRemoteOSBuildString() {
std::optional<std::string> PlatformRemoteGDBServer::GetRemoteOSBuildString() {
if (!m_gdb_client_up)
return std::nullopt;
return m_gdb_client_up->GetOSBuildString();
}

llvm::Optional<std::string>
std::optional<std::string>
PlatformRemoteGDBServer::GetRemoteOSKernelDescription() {
if (!m_gdb_client_up)
return std::nullopt;
Expand Down Expand Up @@ -227,7 +227,7 @@ Status PlatformRemoteGDBServer::ConnectRemote(Args &args) {
if (!url)
return Status("URL is null.");

llvm::Optional<URI> parsed_url = URI::Parse(url);
std::optional<URI> parsed_url = URI::Parse(url);
if (!parsed_url)
return Status("Invalid URL: %s", url);

Expand Down Expand Up @@ -284,15 +284,15 @@ const char *PlatformRemoteGDBServer::GetHostname() {
return m_hostname.c_str();
}

llvm::Optional<std::string>
std::optional<std::string>
PlatformRemoteGDBServer::DoGetUserName(UserIDResolver::id_t uid) {
std::string name;
if (m_gdb_client_up && m_gdb_client_up->GetUserName(uid, name))
return std::move(name);
return std::nullopt;
}

llvm::Optional<std::string>
std::optional<std::string>
PlatformRemoteGDBServer::DoGetGroupName(UserIDResolver::id_t gid) {
std::string name;
if (m_gdb_client_up && m_gdb_client_up->GetGroupName(gid, name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {

bool GetRemoteOSVersion() override;

llvm::Optional<std::string> GetRemoteOSBuildString() override;
std::optional<std::string> GetRemoteOSBuildString() override;

llvm::Optional<std::string> GetRemoteOSKernelDescription() override;
std::optional<std::string> GetRemoteOSKernelDescription() override;

// Remote Platform subclasses need to override this function
ArchSpec GetRemoteSystemArchitecture() override;
Expand Down Expand Up @@ -182,8 +182,8 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {
const std::string &platform_hostname,
uint16_t port, const char *socket_name);

llvm::Optional<std::string> DoGetUserName(UserIDResolver::id_t uid) override;
llvm::Optional<std::string> DoGetGroupName(UserIDResolver::id_t uid) override;
std::optional<std::string> DoGetUserName(UserIDResolver::id_t uid) override;
std::optional<std::string> DoGetGroupName(UserIDResolver::id_t uid) override;

std::vector<ArchSpec> m_supported_architectures;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ uint32_t NativeRegisterContextFreeBSD_mips64::GetUserRegisterCount() const {
return count;
}

llvm::Optional<NativeRegisterContextFreeBSD_mips64::RegSetKind>
std::optional<NativeRegisterContextFreeBSD_mips64::RegSetKind>
NativeRegisterContextFreeBSD_mips64::GetSetForNativeRegNum(
uint32_t reg_num) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
Expand Down Expand Up @@ -121,7 +121,7 @@ NativeRegisterContextFreeBSD_mips64::ReadRegister(const RegisterInfo *reg_info,
? reg_info->name
: "<unknown register>");

llvm::Optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
std::optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
if (!opt_set) {
// This is likely an internal register for lldb use only and should not be
// directly queried.
Expand Down Expand Up @@ -155,7 +155,7 @@ Status NativeRegisterContextFreeBSD_mips64::WriteRegister(
? reg_info->name
: "<unknown register>");

llvm::Optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
std::optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
if (!opt_set) {
// This is likely an internal register for lldb use only and should not be
// directly queried.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class NativeRegisterContextFreeBSD_mips64
};
std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;

llvm::Optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;
std::optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;

Status ReadRegisterSet(RegSetKind set);
Status WriteRegisterSet(RegSetKind set);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ NativeRegisterContextFreeBSD_powerpc::GetRegisterSet(uint32_t set_index) const {
}
}

llvm::Optional<NativeRegisterContextFreeBSD_powerpc::RegSetKind>
std::optional<NativeRegisterContextFreeBSD_powerpc::RegSetKind>
NativeRegisterContextFreeBSD_powerpc::GetSetForNativeRegNum(
uint32_t reg_num) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
Expand Down Expand Up @@ -172,7 +172,7 @@ NativeRegisterContextFreeBSD_powerpc::ReadRegister(const RegisterInfo *reg_info,
? reg_info->name
: "<unknown register>");

llvm::Optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
std::optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
if (!opt_set) {
// This is likely an internal register for lldb use only and should not be
// directly queried.
Expand Down Expand Up @@ -206,7 +206,7 @@ Status NativeRegisterContextFreeBSD_powerpc::WriteRegister(
? reg_info->name
: "<unknown register>");

llvm::Optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
std::optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
if (!opt_set) {
// This is likely an internal register for lldb use only and should not be
// directly queried.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class NativeRegisterContextFreeBSD_powerpc
};
std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;

llvm::Optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;
std::optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;

Status ReadRegisterSet(RegSetKind set);
Status WriteRegisterSet(RegSetKind set);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ NativeRegisterContextFreeBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
}
}

llvm::Optional<NativeRegisterContextFreeBSD_x86_64::RegSetKind>
std::optional<NativeRegisterContextFreeBSD_x86_64::RegSetKind>
NativeRegisterContextFreeBSD_x86_64::GetSetForNativeRegNum(
uint32_t reg_num) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
Expand Down Expand Up @@ -426,7 +426,7 @@ NativeRegisterContextFreeBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
return error;
}

llvm::Optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
std::optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
if (!opt_set) {
// This is likely an internal register for lldb use only and should not be
// directly queried.
Expand Down Expand Up @@ -454,7 +454,7 @@ NativeRegisterContextFreeBSD_x86_64::ReadRegister(const RegisterInfo *reg_info,
break;
}
case YMMRegSet: {
llvm::Optional<YMMSplitPtr> ymm_reg = GetYMMSplitReg(reg);
std::optional<YMMSplitPtr> ymm_reg = GetYMMSplitReg(reg);
if (!ymm_reg) {
error.SetErrorStringWithFormat(
"register \"%s\" not supported by CPU/kernel", reg_info->name);
Expand Down Expand Up @@ -492,7 +492,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegister(
return error;
}

llvm::Optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
std::optional<RegSetKind> opt_set = GetSetForNativeRegNum(reg);
if (!opt_set) {
// This is likely an internal register for lldb use only and should not be
// directly queried.
Expand All @@ -519,7 +519,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegister(
break;
}
case YMMRegSet: {
llvm::Optional<YMMSplitPtr> ymm_reg = GetYMMSplitReg(reg);
std::optional<YMMSplitPtr> ymm_reg = GetYMMSplitReg(reg);
if (!ymm_reg) {
error.SetErrorStringWithFormat(
"register \"%s\" not supported by CPU/kernel", reg_info->name);
Expand Down Expand Up @@ -630,7 +630,7 @@ NativeRegisterContextFreeBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
return base + (reg_offset - m_regset_offsets[set]);
}

llvm::Optional<NativeRegisterContextFreeBSD_x86_64::YMMSplitPtr>
std::optional<NativeRegisterContextFreeBSD_x86_64::YMMSplitPtr>
NativeRegisterContextFreeBSD_x86_64::GetYMMSplitReg(uint32_t reg) {
uint32_t offset = m_xsave_offsets[YMMRegSet];
if (offset == LLDB_INVALID_XSAVE_OFFSET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class NativeRegisterContextFreeBSD_x86_64
std::array<uint32_t, MaxRegSet + 1> m_xsave_offsets;
std::array<size_t, MaxRegSet + 1> m_regset_offsets;

llvm::Optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;
std::optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;

Status ReadRegisterSet(RegSetKind set);
Status WriteRegisterSet(RegSetKind set);
Expand All @@ -86,7 +86,7 @@ class NativeRegisterContextFreeBSD_x86_64
void *xmm;
void *ymm_hi;
};
llvm::Optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg);
std::optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg);
};

} // namespace process_freebsd
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ IntelPTCollector::GetBinaryData(const TraceGetBinaryDataRequest &request) {
return GetProcfsCpuInfo();

if (m_process_trace_up) {
Expected<Optional<std::vector<uint8_t>>> data =
Expected<std::optional<std::vector<uint8_t>>> data =
m_process_trace_up->TryGetBinaryData(request);
if (!data)
return data.takeError();
Expand All @@ -234,7 +234,7 @@ IntelPTCollector::GetBinaryData(const TraceGetBinaryDataRequest &request) {
}

{
Expected<Optional<std::vector<uint8_t>>> data =
Expected<std::optional<std::vector<uint8_t>>> data =
m_thread_traces.TryGetBinaryData(request);
if (!data)
return data.takeError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Error IntelPTMultiCoreTrace::TraceStop(lldb::tid_t tid) {
"per-cpu process tracing is enabled.");
}

Expected<Optional<std::vector<uint8_t>>>
Expected<std::optional<std::vector<uint8_t>>>
IntelPTMultiCoreTrace::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
if (!request.cpu_id)
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class IntelPTMultiCoreTrace : public IntelPTProcessTrace {

llvm::Error TraceStop(lldb::tid_t tid) override;

llvm::Expected<llvm::Optional<std::vector<uint8_t>>>
llvm::Expected<std::optional<std::vector<uint8_t>>>
TryGetBinaryData(const TraceGetBinaryDataRequest &request) override;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TraceIntelPTGetStateResponse IntelPTPerThreadProcessTrace::GetState() {
return state;
}

Expected<llvm::Optional<std::vector<uint8_t>>>
Expected<std::optional<std::vector<uint8_t>>>
IntelPTPerThreadProcessTrace::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
return m_thread_traces.TryGetBinaryData(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class IntelPTPerThreadProcessTrace : public IntelPTProcessTrace {

TraceIntelPTGetStateResponse GetState() override;

llvm::Expected<llvm::Optional<std::vector<uint8_t>>>
llvm::Expected<std::optional<std::vector<uint8_t>>>
TryGetBinaryData(const TraceGetBinaryDataRequest &request) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IntelPTProcessTrace {
/// \b std::nullopt if this instance doesn't support the requested data, an
/// \a llvm::Error if this isntance supports it but fails at fetching it,
/// and \b Error::success() otherwise.
virtual llvm::Expected<llvm::Optional<std::vector<uint8_t>>>
virtual llvm::Expected<std::optional<std::vector<uint8_t>>>
TryGetBinaryData(const TraceGetBinaryDataRequest &request) = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ size_t IntelPTThreadTraceCollection::GetTracedThreadsCount() const {
return m_thread_traces.size();
}

llvm::Expected<llvm::Optional<std::vector<uint8_t>>>
llvm::Expected<std::optional<std::vector<uint8_t>>>
IntelPTThreadTraceCollection::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
if (!request.tid)
Expand Down
Loading