[Lldb-commits] [lldb] 2fe8327 - [lldb] Use std::optional instead of llvm::Optional (NFC)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Sat Jan 7 14:18:44 PST 2023


Author: Kazu Hirata
Date: 2023-01-07T14:18:35-08:00
New Revision: 2fe8327406050d2585d2ced910a678e28caefcf5

URL: https://github.com/llvm/llvm-project/commit/2fe8327406050d2585d2ced910a678e28caefcf5
DIFF: https://github.com/llvm/llvm-project/commit/2fe8327406050d2585d2ced910a678e28caefcf5.diff

LOG: [lldb] Use std::optional instead of llvm::Optional (NFC)

This patch replaces (llvm::|)Optional< with std::optional<.  I'll post
a separate patch to clean up the "using" declarations, #include
"llvm/ADT/Optional.h", etc.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    lldb/bindings/python/python-wrapper.swig
    lldb/docs/resources/contributing.rst
    lldb/include/lldb/Breakpoint/BreakpointID.h
    lldb/include/lldb/Breakpoint/BreakpointResolver.h
    lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
    lldb/include/lldb/Core/DataFileCache.h
    lldb/include/lldb/Core/Debugger.h
    lldb/include/lldb/Core/EmulateInstruction.h
    lldb/include/lldb/Core/Highlighter.h
    lldb/include/lldb/Core/IOHandler.h
    lldb/include/lldb/Core/Module.h
    lldb/include/lldb/Core/Progress.h
    lldb/include/lldb/Core/SourceLocationSpec.h
    lldb/include/lldb/Core/SourceManager.h
    lldb/include/lldb/Core/ValueObject.h
    lldb/include/lldb/Core/ValueObjectCast.h
    lldb/include/lldb/Core/ValueObjectChild.h
    lldb/include/lldb/Core/ValueObjectConstResult.h
    lldb/include/lldb/Core/ValueObjectDynamicValue.h
    lldb/include/lldb/Core/ValueObjectMemory.h
    lldb/include/lldb/Core/ValueObjectRegister.h
    lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
    lldb/include/lldb/Core/ValueObjectVariable.h
    lldb/include/lldb/Expression/ExpressionVariable.h
    lldb/include/lldb/Host/Editline.h
    lldb/include/lldb/Host/File.h
    lldb/include/lldb/Host/FileSystem.h
    lldb/include/lldb/Host/HostInfoBase.h
    lldb/include/lldb/Host/common/NativeProcessProtocol.h
    lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
    lldb/include/lldb/Host/linux/Host.h
    lldb/include/lldb/Host/linux/HostInfoLinux.h
    lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
    lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
    lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
    lldb/include/lldb/Host/posix/HostInfoPosix.h
    lldb/include/lldb/Host/windows/HostInfoWindows.h
    lldb/include/lldb/Interpreter/CommandHistory.h
    lldb/include/lldb/Interpreter/CommandInterpreter.h
    lldb/include/lldb/Interpreter/CommandObject.h
    lldb/include/lldb/Interpreter/CommandObjectMultiword.h
    lldb/include/lldb/Interpreter/ScriptInterpreter.h
    lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
    lldb/include/lldb/Symbol/CompilerType.h
    lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
    lldb/include/lldb/Symbol/ObjectFile.h
    lldb/include/lldb/Symbol/SymbolFile.h
    lldb/include/lldb/Symbol/SymbolFileOnDemand.h
    lldb/include/lldb/Symbol/Type.h
    lldb/include/lldb/Symbol/TypeSystem.h
    lldb/include/lldb/Symbol/UnwindTable.h
    lldb/include/lldb/Target/LanguageRuntime.h
    lldb/include/lldb/Target/MemoryRegionInfo.h
    lldb/include/lldb/Target/MemoryTagMap.h
    lldb/include/lldb/Target/PathMappingList.h
    lldb/include/lldb/Target/Platform.h
    lldb/include/lldb/Target/RemoteAwarePlatform.h
    lldb/include/lldb/Target/StackFrameRecognizer.h
    lldb/include/lldb/Target/Statistics.h
    lldb/include/lldb/Target/Trace.h
    lldb/include/lldb/Target/TraceCursor.h
    lldb/include/lldb/Target/TraceDumper.h
    lldb/include/lldb/Target/UnixSignals.h
    lldb/include/lldb/Utility/Diagnostics.h
    lldb/include/lldb/Utility/FileSpec.h
    lldb/include/lldb/Utility/Predicate.h
    lldb/include/lldb/Utility/SelectHelper.h
    lldb/include/lldb/Utility/StringExtractorGDBRemote.h
    lldb/include/lldb/Utility/Timeout.h
    lldb/include/lldb/Utility/UriParser.h
    lldb/include/lldb/Utility/UserIDResolver.h
    lldb/source/API/SBCommandInterpreter.cpp
    lldb/source/API/SBMemoryRegionInfo.cpp
    lldb/source/API/SBType.cpp
    lldb/source/Breakpoint/BreakpointID.cpp
    lldb/source/Breakpoint/BreakpointResolver.cpp
    lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
    lldb/source/Commands/CommandObjectBreakpoint.cpp
    lldb/source/Commands/CommandObjectCommands.cpp
    lldb/source/Commands/CommandObjectFrame.cpp
    lldb/source/Commands/CommandObjectMemory.cpp
    lldb/source/Commands/CommandObjectMultiword.cpp
    lldb/source/Commands/CommandObjectProcess.cpp
    lldb/source/Commands/CommandObjectSource.cpp
    lldb/source/Commands/CommandObjectThread.cpp
    lldb/source/Core/Debugger.cpp
    lldb/source/Core/DumpDataExtractor.cpp
    lldb/source/Core/EmulateInstruction.cpp
    lldb/source/Core/Highlighter.cpp
    lldb/source/Core/IOHandler.cpp
    lldb/source/Core/IOHandlerCursesGUI.cpp
    lldb/source/Core/Module.cpp
    lldb/source/Core/SourceLocationSpec.cpp
    lldb/source/Core/SourceManager.cpp
    lldb/source/Core/Value.cpp
    lldb/source/Core/ValueObject.cpp
    lldb/source/Core/ValueObjectCast.cpp
    lldb/source/Core/ValueObjectConstResult.cpp
    lldb/source/Core/ValueObjectDynamicValue.cpp
    lldb/source/Core/ValueObjectMemory.cpp
    lldb/source/Core/ValueObjectRegister.cpp
    lldb/source/Core/ValueObjectSyntheticFilter.cpp
    lldb/source/Core/ValueObjectVariable.cpp
    lldb/source/DataFormatters/TypeFormat.cpp
    lldb/source/DataFormatters/VectorType.cpp
    lldb/source/Expression/DWARFExpression.cpp
    lldb/source/Expression/ExpressionVariable.cpp
    lldb/source/Expression/IRExecutionUnit.cpp
    lldb/source/Expression/Materializer.cpp
    lldb/source/Host/common/Editline.cpp
    lldb/source/Host/common/File.cpp
    lldb/source/Host/common/FileSystem.cpp
    lldb/source/Host/common/HostInfoBase.cpp
    lldb/source/Host/common/NativeProcessProtocol.cpp
    lldb/source/Host/common/Terminal.cpp
    lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
    lldb/source/Host/linux/Host.cpp
    lldb/source/Host/linux/HostInfoLinux.cpp
    lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
    lldb/source/Host/netbsd/HostInfoNetBSD.cpp
    lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
    lldb/source/Host/posix/HostInfoPosix.cpp
    lldb/source/Host/windows/HostInfoWindows.cpp
    lldb/source/Interpreter/CommandHistory.cpp
    lldb/source/Interpreter/CommandInterpreter.cpp
    lldb/source/Interpreter/ScriptInterpreter.cpp
    lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
    lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
    lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
    lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
    lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
    lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
    lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
    lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
    lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
    lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
    lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
    lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
    lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
    lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
    lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
    lldb/source/Plugins/ABI/X86/ABIX86.cpp
    lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
    lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
    lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
    lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
    lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
    lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
    lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
    lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
    lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
    lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
    lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
    lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
    lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.h
    lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
    lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
    lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
    lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
    lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
    lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
    lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
    lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h
    lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
    lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
    lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
    lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
    lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
    lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
    lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
    lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
    lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
    lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
    lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
    lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
    lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.h
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
    lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
    lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
    lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
    lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
    lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
    lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
    lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
    lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
    lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
    lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
    lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
    lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
    lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
    lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
    lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
    lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
    lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
    lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
    lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
    lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
    lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp
    lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h
    lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp
    lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h
    lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
    lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
    lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
    lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
    lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
    lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
    lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
    lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
    lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
    lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
    lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
    lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
    lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
    lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
    lldb/source/Plugins/Process/Linux/Procfs.cpp
    lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
    lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
    lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
    lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
    lldb/source/Plugins/Process/Utility/AuxVector.cpp
    lldb/source/Plugins/Process/Utility/AuxVector.h
    lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
    lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/source/Plugins/Process/Utility/StopInfoMachException.h
    lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
    lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
    lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
    lldb/source/Plugins/Process/minidump/MinidumpParser.h
    lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
    lldb/source/Plugins/Process/minidump/MinidumpTypes.h
    lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
    lldb/source/Plugins/Process/minidump/ProcessMinidump.h
    lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h
    lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
    lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
    lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
    lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
    lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
    lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
    lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
    lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
    lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
    lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
    lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
    lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
    lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
    lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
    lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
    lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
    lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
    lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
    lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
    lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
    lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
    lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
    lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
    lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
    lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
    lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
    lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
    lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
    lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
    lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
    lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
    lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
    lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
    lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
    lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
    lldb/source/Plugins/TraceExporter/common/TraceHTR.h
    lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
    lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
    lldb/source/Symbol/CompileUnit.cpp
    lldb/source/Symbol/CompilerType.cpp
    lldb/source/Symbol/DWARFCallFrameInfo.cpp
    lldb/source/Symbol/PostfixExpression.cpp
    lldb/source/Symbol/SymbolFileOnDemand.cpp
    lldb/source/Symbol/Type.cpp
    lldb/source/Symbol/TypeSystem.cpp
    lldb/source/Symbol/UnwindPlan.cpp
    lldb/source/Symbol/UnwindTable.cpp
    lldb/source/Target/MemoryTagMap.cpp
    lldb/source/Target/PathMappingList.cpp
    lldb/source/Target/Platform.cpp
    lldb/source/Target/Process.cpp
    lldb/source/Target/RemoteAwarePlatform.cpp
    lldb/source/Target/Target.cpp
    lldb/source/Target/Thread.cpp
    lldb/source/Target/Trace.cpp
    lldb/source/Target/TraceDumper.cpp
    lldb/source/Target/UnixSignals.cpp
    lldb/source/Utility/Diagnostics.cpp
    lldb/source/Utility/FileSpec.cpp
    lldb/source/Utility/ProcessInfo.cpp
    lldb/source/Utility/SelectHelper.cpp
    lldb/source/Utility/StringExtractorGDBRemote.cpp
    lldb/source/Utility/UriParser.cpp
    lldb/source/Utility/UserIDResolver.cpp
    lldb/tools/lldb-server/Acceptor.cpp
    lldb/tools/lldb-server/lldb-platform.cpp
    lldb/tools/lldb-test/lldb-test.cpp
    lldb/tools/lldb-vscode/FifoFiles.cpp
    lldb/tools/lldb-vscode/JSONUtils.cpp
    lldb/tools/lldb-vscode/JSONUtils.h
    lldb/tools/lldb-vscode/ProgressEvent.cpp
    lldb/tools/lldb-vscode/ProgressEvent.h
    lldb/unittests/DataFormatter/StringPrinterTests.cpp
    lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
    lldb/unittests/Language/Highlighting/HighlighterTest.cpp
    lldb/unittests/Platform/PlatformSiginfoTest.cpp
    lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
    lldb/unittests/Process/minidump/MinidumpParserTest.cpp
    lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
    lldb/unittests/Symbol/TestLineEntry.cpp
    lldb/unittests/Target/FindFileTest.cpp
    lldb/unittests/Target/MemoryTagMapTest.cpp
    lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
    lldb/unittests/Utility/ProcessInstanceInfoTest.cpp
    lldb/unittests/Utility/RegisterValueTest.cpp
    lldb/unittests/Utility/UserIDResolverTest.cpp
    lldb/unittests/tools/lldb-server/tests/TestClient.h

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig
index 7342d9d7e82f8..91b26fff05a1c 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -941,7 +941,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess(
   return true;
 }
 
-llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
+std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
     const char *python_function_name, const char *session_dictionary_name,
     lldb::ThreadSP thread) {
   if (python_function_name == NULL || python_function_name[0] == '\0' ||
@@ -988,7 +988,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
   return true;
 }
 
-llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
+std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
     const char *python_function_name, const char *session_dictionary_name,
     lldb::StackFrameSP frame) {
   if (python_function_name == NULL || python_function_name[0] == '\0' ||

diff  --git a/lldb/docs/resources/contributing.rst b/lldb/docs/resources/contributing.rst
index 26b13a5b745cf..b2d4cf0e47181 100644
--- a/lldb/docs/resources/contributing.rst
+++ b/lldb/docs/resources/contributing.rst
@@ -44,7 +44,7 @@ rules of thumb:
   missing object files, or otherwise inconsistent debug info, LLVM's
   error handling types such as `llvm::Expected<T>
   <https://llvm.org/doxygen/classllvm_1_1Expected.html>`_ or
-  `llvm::Optional<T>
+  `std::optional<T>
   <https://llvm.org/doxygen/classllvm_1_1Optional.html>`_ should be
   used. Functions that may fail should return their result using these
   wrapper types instead of using a bool to indicate success. Returning

diff  --git a/lldb/include/lldb/Breakpoint/BreakpointID.h b/lldb/include/lldb/Breakpoint/BreakpointID.h
index 4d171f03a5928..dff901163cb03 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointID.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointID.h
@@ -58,7 +58,7 @@ class BreakpointID {
   ///     If \p input was not a valid breakpoint ID string, returns
   ///     \b std::nullopt.  Otherwise returns a BreakpointID with members filled
   ///     out accordingly.
-  static llvm::Optional<BreakpointID>
+  static std::optional<BreakpointID>
   ParseCanonicalReference(llvm::StringRef input);
 
   /// Takes an input string and checks to see whether it is a breakpoint name.

diff  --git a/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/lldb/include/lldb/Breakpoint/BreakpointResolver.h
index 6c71f199179aa..a0b37c94ac2b4 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h
@@ -206,7 +206,7 @@ class BreakpointResolver : public Searcher {
   void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list,
                           bool skip_prologue, llvm::StringRef log_ident,
                           uint32_t line = 0,
-                          llvm::Optional<uint16_t> column = std::nullopt);
+                          std::optional<uint16_t> column = std::nullopt);
   void SetSCMatchesByLine(SearchFilter &, SymbolContextList &, bool,
                           const char *) = delete;
 

diff  --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index 5bf8d3e72cd94..5864a284d6f1e 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -25,7 +25,7 @@ class BreakpointResolverFileLine : public BreakpointResolver {
   BreakpointResolverFileLine(
       const lldb::BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue,
       const SourceLocationSpec &location_spec,
-      llvm::Optional<llvm::StringRef> removed_prefix_opt = std::nullopt);
+      std::optional<llvm::StringRef> removed_prefix_opt = std::nullopt);
 
   static BreakpointResolver *
   CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
@@ -66,7 +66,7 @@ class BreakpointResolverFileLine : public BreakpointResolver {
   bool m_skip_prologue;
   // Any previously removed file path prefix by reverse source mapping.
   // This is used to auto deduce source map if needed.
-  llvm::Optional<llvm::StringRef> m_removed_prefix_opt;
+  std::optional<llvm::StringRef> m_removed_prefix_opt;
 
 private:
   BreakpointResolverFileLine(const BreakpointResolverFileLine &) = delete;

diff  --git a/lldb/include/lldb/Core/DataFileCache.h b/lldb/include/lldb/Core/DataFileCache.h
index 4ad943c0431b1..5b634435ad768 100644
--- a/lldb/include/lldb/Core/DataFileCache.h
+++ b/lldb/include/lldb/Core/DataFileCache.h
@@ -108,13 +108,13 @@ class DataFileCache {
 /// it is out of date.
 struct CacheSignature {
   /// UUID of object file or module.
-  llvm::Optional<UUID> m_uuid = std::nullopt;
+  std::optional<UUID> m_uuid = std::nullopt;
   /// Modification time of file on disk.
-  llvm::Optional<std::time_t> m_mod_time = std::nullopt;
+  std::optional<std::time_t> m_mod_time = std::nullopt;
   /// If this describes a .o file with a BSD archive, the BSD archive's
   /// modification time will be in m_mod_time, and the .o file's modification
   /// time will be in this m_obj_mod_time.
-  llvm::Optional<std::time_t> m_obj_mod_time = std::nullopt;
+  std::optional<std::time_t> m_obj_mod_time = std::nullopt;
 
   CacheSignature() = default;
 

diff  --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 636ac234137d9..dd3e6c061fcf6 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -174,7 +174,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
 
   ScriptInterpreter *
   GetScriptInterpreter(bool can_create = true,
-                       llvm::Optional<lldb::ScriptLanguage> language = {});
+                       std::optional<lldb::ScriptLanguage> language = {});
 
   lldb::ListenerSP GetListener() { return m_listener_sp; }
 
@@ -403,7 +403,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   ///   ensure the given warning is only broadcast once.
   static void
   ReportWarning(std::string message,
-                llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
+                std::optional<lldb::user_id_t> debugger_id = std::nullopt,
                 std::once_flag *once = nullptr);
 
   /// Report error events.
@@ -425,7 +425,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   ///   ensure the given error is only broadcast once.
   static void
   ReportError(std::string message,
-              llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
+              std::optional<lldb::user_id_t> debugger_id = std::nullopt,
               std::once_flag *once = nullptr);
 
   /// Report info events.
@@ -445,7 +445,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   ///   ensure the given info is only logged once.
   static void
   ReportInfo(std::string message,
-             llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
+             std::optional<lldb::user_id_t> debugger_id = std::nullopt,
              std::once_flag *once = nullptr);
 
   static void ReportSymbolChange(const ModuleSpec &module_spec);
@@ -486,11 +486,11 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   ///   delivered to all debuggers.
   static void ReportProgress(uint64_t progress_id, const std::string &message,
                              uint64_t completed, uint64_t total,
-                             llvm::Optional<lldb::user_id_t> debugger_id);
+                             std::optional<lldb::user_id_t> debugger_id);
 
   static void ReportDiagnosticImpl(DiagnosticEventData::Type type,
                                    std::string message,
-                                   llvm::Optional<lldb::user_id_t> debugger_id,
+                                   std::optional<lldb::user_id_t> debugger_id,
                                    std::once_flag *once);
 
   void PrintProgress(const ProgressEventData &data);
@@ -574,7 +574,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   IOHandlerStack m_io_handler_stack;
   std::recursive_mutex m_io_handler_synchronous_mutex;
 
-  llvm::Optional<uint64_t> m_current_event_id;
+  std::optional<uint64_t> m_current_event_id;
 
   llvm::StringMap<std::weak_ptr<LogHandler>> m_stream_handlers;
   std::shared_ptr<CallbackLogHandler> m_callback_handler_sp;

diff  --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h
index 21688021ac8ec..6d76380ce6592 100644
--- a/lldb/include/lldb/Core/EmulateInstruction.h
+++ b/lldb/include/lldb/Core/EmulateInstruction.h
@@ -378,7 +378,7 @@ class EmulateInstruction : public PluginInterface {
   virtual bool TestEmulation(Stream *out_stream, ArchSpec &arch,
                              OptionValueDictionary *test_data) = 0;
 
-  virtual llvm::Optional<RegisterInfo>
+  virtual std::optional<RegisterInfo>
   GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) = 0;
 
   // Optional overrides
@@ -391,7 +391,7 @@ class EmulateInstruction : public PluginInterface {
                                        uint32_t reg_num, std::string &reg_name);
 
   // RegisterInfo variants
-  llvm::Optional<RegisterValue> ReadRegister(const RegisterInfo &reg_info);
+  std::optional<RegisterValue> ReadRegister(const RegisterInfo &reg_info);
 
   uint64_t ReadRegisterUnsigned(const RegisterInfo &reg_info,
                                 uint64_t fail_value, bool *success_ptr);

diff  --git a/lldb/include/lldb/Core/Highlighter.h b/lldb/include/lldb/Core/Highlighter.h
index 258d47c2affa7..58ecd37180e5f 100644
--- a/lldb/include/lldb/Core/Highlighter.h
+++ b/lldb/include/lldb/Core/Highlighter.h
@@ -113,12 +113,12 @@ class Highlighter {
   ///     The stream to which the highlighted version of the user string should
   ///     be written.
   virtual 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 = 0;
 
   /// Utility method for calling Highlight without a stream.
   std::string Highlight(const HighlightStyle &options, llvm::StringRef line,
-                        llvm::Optional<size_t> cursor_pos,
+                        std::optional<size_t> cursor_pos,
                         llvm::StringRef previous_lines = "") const;
 };
 
@@ -129,7 +129,7 @@ class DefaultHighlighter : public Highlighter {
   llvm::StringRef GetName() const override { return "none"; }
 
   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;
 };
 

diff  --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h
index f2f9fa0efde1a..18d87acbd8722 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -201,8 +201,8 @@ class IOHandlerDelegate {
 
   virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
 
-  virtual llvm::Optional<std::string> IOHandlerSuggestion(IOHandler &io_handler,
-                                                          llvm::StringRef line);
+  virtual std::optional<std::string> IOHandlerSuggestion(IOHandler &io_handler,
+                                                         llvm::StringRef line);
 
   virtual void IOHandlerComplete(IOHandler &io_handler,
                                  CompletionRequest &request);
@@ -418,7 +418,7 @@ class IOHandlerEditline : public IOHandler {
   int FixIndentationCallback(Editline *editline, const StringList &lines,
                              int cursor_position);
 
-  llvm::Optional<std::string> SuggestionCallback(llvm::StringRef line);
+  std::optional<std::string> SuggestionCallback(llvm::StringRef line);
 
   void AutoCompleteCallback(CompletionRequest &request);
 #endif

diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 8ea6a27e47450..56c3de1249c9b 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -842,11 +842,11 @@ class Module : public std::enable_shared_from_this<Module>,
   void ReportErrorIfModifyDetected(const char *format, ...)
       __attribute__((format(printf, 2, 3)));
 
-  void ReportWarningOptimization(llvm::Optional<lldb::user_id_t> debugger_id);
+  void ReportWarningOptimization(std::optional<lldb::user_id_t> debugger_id);
 
   void
   ReportWarningUnsupportedLanguage(lldb::LanguageType language,
-                                   llvm::Optional<lldb::user_id_t> debugger_id);
+                                   std::optional<lldb::user_id_t> debugger_id);
 
   // Return true if the file backing this module has changed since the module
   // was originally created  since we saved the initial file modification time
@@ -895,7 +895,7 @@ class Module : public std::enable_shared_from_this<Module>,
   /// \return
   ///     The newly remapped filespec that is may or may not exist if
   ///     \a path was successfully located.
-  llvm::Optional<std::string> RemapSourceFile(llvm::StringRef path) const;
+  std::optional<std::string> RemapSourceFile(llvm::StringRef path) const;
   bool RemapSourceFile(const char *, std::string &) const = delete;
 
   /// Update the ArchSpec to a more specific variant.
@@ -1054,9 +1054,9 @@ class Module : public std::enable_shared_from_this<Module>,
   lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
                                    /// parser for this module as it may or may
                                    /// not be shared with the SymbolFile
-  llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
-                                              /// objects created for this
-                                              /// Module's functions
+  std::optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
+                                             /// objects created for this
+                                             /// Module's functions
   lldb::SymbolVendorUP
       m_symfile_up; ///< A pointer to the symbol vendor for this module.
   std::vector<lldb::SymbolVendorUP>

diff  --git a/lldb/include/lldb/Core/Progress.h b/lldb/include/lldb/Core/Progress.h
index 9238647e5b0bc..48078705ae6b8 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -103,7 +103,7 @@ class Progress {
   const uint64_t m_total;
   /// The optional debugger ID to report progress to. If this has no value then
   /// all debuggers will receive this event.
-  llvm::Optional<lldb::user_id_t> m_debugger_id;
+  std::optional<lldb::user_id_t> m_debugger_id;
   /// Set to true when progress has been reported where m_completed == m_total
   /// to ensure that we don't send progress updates after progress has
   /// completed.

diff  --git a/lldb/include/lldb/Core/SourceLocationSpec.h b/lldb/include/lldb/Core/SourceLocationSpec.h
index 8fbb32ac22247..3550dc02f6543 100644
--- a/lldb/include/lldb/Core/SourceLocationSpec.h
+++ b/lldb/include/lldb/Core/SourceLocationSpec.h
@@ -48,7 +48,7 @@ class SourceLocationSpec {
   ///     Whether to look for an exact match.
   ///
   explicit SourceLocationSpec(FileSpec file_spec, uint32_t line,
-                              llvm::Optional<uint16_t> column = std::nullopt,
+                              std::optional<uint16_t> column = std::nullopt,
                               bool check_inlines = false,
                               bool exact_match = false);
 
@@ -166,9 +166,9 @@ class SourceLocationSpec {
 
   FileSpec GetFileSpec() const { return m_declaration.GetFile(); }
 
-  llvm::Optional<uint32_t> GetLine() const;
+  std::optional<uint32_t> GetLine() const;
 
-  llvm::Optional<uint16_t> GetColumn() const;
+  std::optional<uint16_t> GetColumn() const;
 
   bool GetCheckInlines() const { return m_check_inlines; }
 

diff  --git a/lldb/include/lldb/Core/SourceManager.h b/lldb/include/lldb/Core/SourceManager.h
index 382b20666052d..c272f7f431129 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -42,7 +42,7 @@ class SourceManager {
 
     void UpdateIfNeeded();
 
-    size_t DisplaySourceLines(uint32_t line, llvm::Optional<size_t> column,
+    size_t DisplaySourceLines(uint32_t line, std::optional<size_t> column,
                               uint32_t context_before, uint32_t context_after,
                               Stream *s);
     void FindLinesMatchingRegex(RegularExpression &regex, uint32_t start_line,

diff  --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index 0f3ae9b554b44..398c6e914cbb8 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -358,7 +358,7 @@ class ValueObject {
   virtual bool CanProvideValue();
 
   // Subclasses must implement the functions below.
-  virtual llvm::Optional<uint64_t> GetByteSize() = 0;
+  virtual std::optional<uint64_t> GetByteSize() = 0;
 
   virtual lldb::ValueType GetValueType() const = 0;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectCast.h b/lldb/include/lldb/Core/ValueObjectCast.h
index b9604ffd2a978..fe053c12d9c34 100644
--- a/lldb/include/lldb/Core/ValueObjectCast.h
+++ b/lldb/include/lldb/Core/ValueObjectCast.h
@@ -31,7 +31,7 @@ class ValueObjectCast : public ValueObject {
                                     ConstString name,
                                     const CompilerType &cast_type);
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   size_t CalculateNumChildren(uint32_t max) override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectChild.h b/lldb/include/lldb/Core/ValueObjectChild.h
index 949b90e1efd56..a655911bf7bd0 100644
--- a/lldb/include/lldb/Core/ValueObjectChild.h
+++ b/lldb/include/lldb/Core/ValueObjectChild.h
@@ -31,7 +31,7 @@ class ValueObjectChild : public ValueObject {
 public:
   ~ValueObjectChild() override;
 
-  llvm::Optional<uint64_t> GetByteSize() override { return m_byte_size; }
+  std::optional<uint64_t> GetByteSize() override { return m_byte_size; }
 
   lldb::offset_t GetByteOffset() override { return m_byte_offset; }
 
@@ -70,7 +70,7 @@ class ValueObjectChild : public ValueObject {
   uint8_t m_bitfield_bit_offset;
   bool m_is_base_class;
   bool m_is_deref_of_parent;
-  llvm::Optional<LazyBool> m_can_update_with_invalid_exe_ctx;
+  std::optional<LazyBool> m_can_update_with_invalid_exe_ctx;
 
   friend class ValueObject;
   friend class ValueObjectConstResult;

diff  --git a/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h
index 3625828b801d9..4edd495216061 100644
--- a/lldb/include/lldb/Core/ValueObjectConstResult.h
+++ b/lldb/include/lldb/Core/ValueObjectConstResult.h
@@ -63,7 +63,7 @@ class ValueObjectConstResult : public ValueObject {
   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
                                     const Status &error);
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   lldb::ValueType GetValueType() const override;
 
@@ -114,7 +114,7 @@ class ValueObjectConstResult : public ValueObject {
   CompilerType GetCompilerTypeImpl() override;
 
   ConstString m_type_name;
-  llvm::Optional<uint64_t> m_byte_size;
+  std::optional<uint64_t> m_byte_size;
 
   ValueObjectConstResultImpl m_impl;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index 36d9be9623974..2758b4e5bb564 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -35,7 +35,7 @@ class ValueObjectDynamicValue : public ValueObject {
 public:
   ~ValueObjectDynamicValue() override = default;
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   ConstString GetTypeName() override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectMemory.h b/lldb/include/lldb/Core/ValueObjectMemory.h
index 2666ff44d84c3..3c01df388d2e6 100644
--- a/lldb/include/lldb/Core/ValueObjectMemory.h
+++ b/lldb/include/lldb/Core/ValueObjectMemory.h
@@ -41,7 +41,7 @@ class ValueObjectMemory : public ValueObject {
                                     const Address &address,
                                     const CompilerType &ast_type);
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   ConstString GetTypeName() override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h
index 9277eaa0d2638..60c299c5fb407 100644
--- a/lldb/include/lldb/Core/ValueObjectRegister.h
+++ b/lldb/include/lldb/Core/ValueObjectRegister.h
@@ -37,7 +37,7 @@ class ValueObjectRegisterSet : public ValueObject {
                                     lldb::RegisterContextSP &reg_ctx_sp,
                                     uint32_t set_idx);
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   lldb::ValueType GetValueType() const override {
     return lldb::eValueTypeRegisterSet;
@@ -87,7 +87,7 @@ class ValueObjectRegister : public ValueObject {
                                     lldb::RegisterContextSP &reg_ctx_sp,
                                     const RegisterInfo *reg_info);
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   lldb::ValueType GetValueType() const override {
     return lldb::eValueTypeRegister;

diff  --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
index 27d25fb1526ea..bdd6c1be4212e 100644
--- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -37,7 +37,7 @@ class ValueObjectSynthetic : public ValueObject {
 public:
   ~ValueObjectSynthetic() override;
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   ConstString GetTypeName() override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h
index 23be7aedac319..bba28ce567b2a 100644
--- a/lldb/include/lldb/Core/ValueObjectVariable.h
+++ b/lldb/include/lldb/Core/ValueObjectVariable.h
@@ -38,7 +38,7 @@ class ValueObjectVariable : public ValueObject {
   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
                                     const lldb::VariableSP &var_sp);
 
-  llvm::Optional<uint64_t> GetByteSize() override;
+  std::optional<uint64_t> GetByteSize() override;
 
   ConstString GetTypeName() override;
 

diff  --git a/lldb/include/lldb/Expression/ExpressionVariable.h b/lldb/include/lldb/Expression/ExpressionVariable.h
index d1a3261f98ab1..27343530780a1 100644
--- a/lldb/include/lldb/Expression/ExpressionVariable.h
+++ b/lldb/include/lldb/Expression/ExpressionVariable.h
@@ -33,7 +33,7 @@ class ExpressionVariable
 
   virtual ~ExpressionVariable();
 
-  llvm::Optional<uint64_t> GetByteSize() { return m_frozen_sp->GetByteSize(); }
+  std::optional<uint64_t> GetByteSize() { return m_frozen_sp->GetByteSize(); }
 
   ConstString GetName() { return m_frozen_sp->GetName(); }
 
@@ -227,7 +227,7 @@ class PersistentExpressionState : public ExpressionVariableList {
   virtual void
   RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0;
 
-  virtual llvm::Optional<CompilerType>
+  virtual std::optional<CompilerType>
   GetCompilerTypeFromPersistentDecl(ConstString type_name) = 0;
 
   virtual lldb::addr_t LookupSymbol(ConstString name);

diff  --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h
index ee92121b51e35..bda3f06d8946c 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -99,7 +99,7 @@ using FixIndentationCallbackType =
     llvm::unique_function<int(Editline *, StringList &, int)>;
 
 using SuggestionCallbackType =
-    llvm::unique_function<llvm::Optional<std::string>(llvm::StringRef)>;
+    llvm::unique_function<std::optional<std::string>(llvm::StringRef)>;
 
 using CompleteCallbackType = llvm::unique_function<void(CompletionRequest &)>;
 

diff  --git a/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h
index 85c1ae8bce94e..ba5772dfe10af 100644
--- a/lldb/include/lldb/Host/File.h
+++ b/lldb/include/lldb/Host/File.h
@@ -438,10 +438,10 @@ class NativeFile : public File {
 class SerialPort : public NativeFile {
 public:
   struct Options {
-    llvm::Optional<unsigned int> BaudRate = std::nullopt;
-    llvm::Optional<Terminal::Parity> Parity = std::nullopt;
-    llvm::Optional<Terminal::ParityCheck> ParityCheck = std::nullopt;
-    llvm::Optional<unsigned int> StopBits = std::nullopt;
+    std::optional<unsigned int> BaudRate = std::nullopt;
+    std::optional<Terminal::Parity> Parity = std::nullopt;
+    std::optional<Terminal::ParityCheck> ParityCheck = std::nullopt;
+    std::optional<unsigned int> StopBits = std::nullopt;
   };
 
   // Obtain Options corresponding to the passed URL query string

diff  --git a/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h
index 52242acf2e2b1..aefad00ebd9b2 100644
--- a/lldb/include/lldb/Host/FileSystem.h
+++ b/lldb/include/lldb/Host/FileSystem.h
@@ -196,7 +196,7 @@ class FileSystem {
   void SetHomeDirectory(std::string home_directory);
 
 private:
-  static llvm::Optional<FileSystem> &InstanceImpl();
+  static std::optional<FileSystem> &InstanceImpl();
   llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
   std::string m_home_directory;
 };

diff  --git a/lldb/include/lldb/Host/HostInfoBase.h b/lldb/include/lldb/Host/HostInfoBase.h
index 11a50cf59e85b..42f71d91f9bf9 100644
--- a/lldb/include/lldb/Host/HostInfoBase.h
+++ b/lldb/include/lldb/Host/HostInfoBase.h
@@ -65,7 +65,8 @@ class HostInfoBase {
   static const ArchSpec &
   GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
 
-  static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
+  static std::optional<ArchitectureKind>
+  ParseArchitectureKind(llvm::StringRef kind);
 
   /// Returns the directory containing the lldb shared library. Only the
   /// directory member of the FileSpec is filled in.

diff  --git a/lldb/include/lldb/Host/common/NativeProcessProtocol.h b/lldb/include/lldb/Host/common/NativeProcessProtocol.h
index b1d6638594b3d..057c07b1536f6 100644
--- a/lldb/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/lldb/include/lldb/Host/common/NativeProcessProtocol.h
@@ -172,7 +172,7 @@ class NativeProcessProtocol {
   // Watchpoint functions
   virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const;
 
-  virtual llvm::Optional<std::pair<uint32_t, uint32_t>>
+  virtual std::optional<std::pair<uint32_t, uint32_t>>
   GetHardwareDebugSupportInfo() const;
 
   virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
@@ -205,7 +205,7 @@ class NativeProcessProtocol {
   GetAuxvData() const = 0;
 
   // Exit Status
-  virtual llvm::Optional<WaitStatus> GetExitStatus();
+  virtual std::optional<WaitStatus> GetExitStatus();
 
   virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange);
 
@@ -423,7 +423,7 @@ class NativeProcessProtocol {
   lldb::StateType m_state = lldb::eStateInvalid;
   mutable std::recursive_mutex m_state_mutex;
 
-  llvm::Optional<WaitStatus> m_exit_status;
+  std::optional<WaitStatus> m_exit_status;
 
   NativeDelegate &m_delegate;
   NativeWatchpointList m_watchpoint_list;

diff  --git a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
index 1d7d8fe0f6b8f..d265b8acf5a1c 100644
--- a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
+++ b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h
@@ -19,7 +19,7 @@ namespace lldb_private {
 class HostInfoFreeBSD : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
-  static llvm::Optional<std::string> GetOSBuildString();
+  static std::optional<std::string> GetOSBuildString();
   static FileSpec GetProgramFileSpec();
 };
 }

diff  --git a/lldb/include/lldb/Host/linux/Host.h b/lldb/include/lldb/Host/linux/Host.h
index f17c5b60a191f..08ac41b01abe5 100644
--- a/lldb/include/lldb/Host/linux/Host.h
+++ b/lldb/include/lldb/Host/linux/Host.h
@@ -16,7 +16,7 @@
 namespace lldb_private {
 
 // Get PID (i.e. the primary thread ID) corresponding to the specified TID.
-llvm::Optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid);
+std::optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid);
 
 } // namespace lldb_private
 

diff  --git a/lldb/include/lldb/Host/linux/HostInfoLinux.h b/lldb/include/lldb/Host/linux/HostInfoLinux.h
index 6cf4ace9b8992..2964f3f1dc989 100644
--- a/lldb/include/lldb/Host/linux/HostInfoLinux.h
+++ b/lldb/include/lldb/Host/linux/HostInfoLinux.h
@@ -27,7 +27,7 @@ class HostInfoLinux : public HostInfoPosix {
   static void Terminate();
 
   static llvm::VersionTuple GetOSVersion();
-  static llvm::Optional<std::string> GetOSBuildString();
+  static std::optional<std::string> GetOSBuildString();
   static llvm::StringRef GetDistributionId();
   static FileSpec GetProgramFileSpec();
 

diff  --git a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
index ebe77c6960518..0402509cfa261 100644
--- a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -25,7 +25,7 @@ class HostInfoMacOSX : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
   static llvm::VersionTuple GetMacCatalystVersion();
-  static llvm::Optional<std::string> GetOSBuildString();
+  static std::optional<std::string> GetOSBuildString();
   static FileSpec GetProgramFileSpec();
   static FileSpec GetXcodeContentsDirectory();
   static FileSpec GetXcodeDeveloperDirectory();

diff  --git a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
index 2024af721afc0..01daefaedbada 100644
--- a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
+++ b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h
@@ -19,7 +19,7 @@ namespace lldb_private {
 class HostInfoNetBSD : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
-  static llvm::Optional<std::string> GetOSBuildString();
+  static std::optional<std::string> GetOSBuildString();
   static FileSpec GetProgramFileSpec();
 };
 }

diff  --git a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
index 9746debd0ef68..ed8aa2a4d2cf8 100644
--- a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
+++ b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h
@@ -19,7 +19,7 @@ namespace lldb_private {
 class HostInfoOpenBSD : public HostInfoPosix {
 public:
   static llvm::VersionTuple GetOSVersion();
-  static llvm::Optional<std::string> GetOSBuildString();
+  static std::optional<std::string> GetOSBuildString();
   static FileSpec GetProgramFileSpec();
 };
 }

diff  --git a/lldb/include/lldb/Host/posix/HostInfoPosix.h b/lldb/include/lldb/Host/posix/HostInfoPosix.h
index 407fa4925f5b1..8d070d3ac1e6f 100644
--- a/lldb/include/lldb/Host/posix/HostInfoPosix.h
+++ b/lldb/include/lldb/Host/posix/HostInfoPosix.h
@@ -23,7 +23,7 @@ class HostInfoPosix : public HostInfoBase {
 public:
   static size_t GetPageSize();
   static bool GetHostname(std::string &s);
-  static llvm::Optional<std::string> GetOSKernelDescription();
+  static std::optional<std::string> GetOSKernelDescription();
 
   static uint32_t GetUserID();
   static uint32_t GetGroupID();

diff  --git a/lldb/include/lldb/Host/windows/HostInfoWindows.h b/lldb/include/lldb/Host/windows/HostInfoWindows.h
index b8381faf58b52..8a4f5c7cb84d8 100644
--- a/lldb/include/lldb/Host/windows/HostInfoWindows.h
+++ b/lldb/include/lldb/Host/windows/HostInfoWindows.h
@@ -28,8 +28,8 @@ class HostInfoWindows : public HostInfoBase {
   static UserIDResolver &GetUserIDResolver();
 
   static llvm::VersionTuple GetOSVersion();
-  static llvm::Optional<std::string> GetOSBuildString();
-  static llvm::Optional<std::string> GetOSKernelDescription();
+  static std::optional<std::string> GetOSBuildString();
+  static std::optional<std::string> GetOSKernelDescription();
   static bool GetHostname(std::string &s);
   static FileSpec GetProgramFileSpec();
   static FileSpec GetDefaultShell();

diff  --git a/lldb/include/lldb/Interpreter/CommandHistory.h b/lldb/include/lldb/Interpreter/CommandHistory.h
index 60a2df34c56a6..aa3018573fdc0 100644
--- a/lldb/include/lldb/Interpreter/CommandHistory.h
+++ b/lldb/include/lldb/Interpreter/CommandHistory.h
@@ -29,7 +29,7 @@ class CommandHistory {
 
   bool IsEmpty() const;
 
-  llvm::Optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
+  std::optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
 
   llvm::StringRef GetStringAtIndex(size_t idx) const;
 

diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index e73999ef8e11a..38ff061612b11 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -407,7 +407,7 @@ class CommandInterpreter : public Broadcaster,
 
   /// Returns the auto-suggestion string that should be added to the given
   /// command line.
-  llvm::Optional<std::string> GetAutoSuggestionForCommand(llvm::StringRef line);
+  std::optional<std::string> GetAutoSuggestionForCommand(llvm::StringRef line);
 
   // This handles command line completion.
   void HandleCompletion(CompletionRequest &request);
@@ -743,7 +743,7 @@ class CommandInterpreter : public Broadcaster,
 
   // The exit code the user has requested when calling the 'quit' command.
   // No value means the user hasn't set a custom exit code so far.
-  llvm::Optional<int> m_quit_exit_code;
+  std::optional<int> m_quit_exit_code;
   // If the driver is accepts custom exit codes for the 'quit' command.
   bool m_allow_exit_code = false;
 

diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h
index cebd8a358e25a..86750a49bd323 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -278,7 +278,7 @@ class CommandObject : public std::enable_shared_from_this<CommandObject> {
   ///     current command line.
   ///     Otherwise a std::string containing the command to be repeated.
   ///     If the string is empty, the command won't be allow repeating.
-  virtual llvm::Optional<std::string>
+  virtual std::optional<std::string>
   GetRepeatCommand(Args &current_command_args, uint32_t index) {
     return std::nullopt;
   }

diff  --git a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
index 4414011dd28f5..1c14b492c8097 100644
--- a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
+++ b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -56,8 +56,8 @@ class CommandObjectMultiword : public CommandObject {
 
   void HandleCompletion(CompletionRequest &request) override;
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override;
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override;
 
   bool Execute(const char *args_string, CommandReturnObject &result) override;
 
@@ -121,8 +121,8 @@ class CommandObjectProxy : public CommandObject {
   HandleArgumentCompletion(CompletionRequest &request,
                            OptionElementVector &opt_element_vector) override;
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override;
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override;
 
   /// \return
   ///     An error message to be displayed when the command is executed (i.e.

diff  --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
index 548b84f2bcd04..ec561804c2580 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -576,7 +576,7 @@ class ScriptInterpreter : public PluginInterface {
 
   Status GetStatusFromSBError(const lldb::SBError &error) const;
 
-  llvm::Optional<MemoryRegionInfo> GetOpaqueTypeFromSBMemoryRegionInfo(
+  std::optional<MemoryRegionInfo> GetOpaqueTypeFromSBMemoryRegionInfo(
       const lldb::SBMemoryRegionInfo &mem_region) const;
 
 protected:

diff  --git a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
index beaadb373dd37..6d1860aa310a0 100644
--- a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
+++ b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
@@ -36,7 +36,7 @@ class ScriptedProcessInterface : virtual public ScriptedInterface {
 
   virtual Status Stop() { return Status("ScriptedProcess did not stop"); }
 
-  virtual llvm::Optional<MemoryRegionInfo>
+  virtual std::optional<MemoryRegionInfo>
   GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) {
     error.SetErrorString("ScriptedProcess have no memory region.");
     return {};
@@ -63,7 +63,7 @@ class ScriptedProcessInterface : virtual public ScriptedInterface {
 
   virtual bool IsAlive() { return true; }
 
-  virtual llvm::Optional<std::string> GetScriptedThreadPluginName() {
+  virtual std::optional<std::string> GetScriptedThreadPluginName() {
     return std::nullopt;
   }
 
@@ -87,11 +87,11 @@ class ScriptedThreadInterface : virtual public ScriptedInterface {
 
   virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; }
 
-  virtual llvm::Optional<std::string> GetName() { return std::nullopt; }
+  virtual std::optional<std::string> GetName() { return std::nullopt; }
 
   virtual lldb::StateType GetState() { return lldb::eStateInvalid; }
 
-  virtual llvm::Optional<std::string> GetQueue() { return std::nullopt; }
+  virtual std::optional<std::string> GetQueue() { return std::nullopt; }
 
   virtual StructuredData::DictionarySP GetStopReason() { return {}; }
 
@@ -99,7 +99,7 @@ class ScriptedThreadInterface : virtual public ScriptedInterface {
 
   virtual StructuredData::DictionarySP GetRegisterInfo() { return {}; }
 
-  virtual llvm::Optional<std::string> GetRegisterContext() {
+  virtual std::optional<std::string> GetRegisterContext() {
     return std::nullopt;
   }
 

diff  --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h
index 818420fca5829..c96fc5a2b6886 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -327,16 +327,15 @@ class CompilerType {
   struct IntegralTemplateArgument;
 
   /// Return the size of the type in bytes.
-  llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope) const;
+  std::optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope) const;
   /// Return the size of the type in bits.
-  llvm::Optional<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;
+  std::optional<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;
 
   lldb::Encoding GetEncoding(uint64_t &count) const;
 
   lldb::Format GetFormat() const;
 
-  llvm::Optional<size_t>
-  GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
+  std::optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
 
   uint32_t GetNumChildren(bool omit_empty_base_classes,
                           const ExecutionContext *exe_ctx) const;
@@ -419,7 +418,7 @@ class CompilerType {
   /// expanded to their supplied arguments. With expand_pack set to false, an
   /// arguement pack will count as 1 argument and it is invalid to call this
   /// method on the pack argument.
-  llvm::Optional<IntegralTemplateArgument>
+  std::optional<IntegralTemplateArgument>
   GetIntegralTemplateArgument(size_t idx, bool expand_pack = false) const;
 
   CompilerType GetTypeForFormatters() const;

diff  --git a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
index be70ac4273ead..ea5c325e11a35 100644
--- a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
+++ b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
@@ -123,7 +123,7 @@ class DWARFCallFrameInfo {
 
   bool IsEHFrame() const;
 
-  llvm::Optional<FDEEntryMap::Entry>
+  std::optional<FDEEntryMap::Entry>
   GetFirstFDEEntryInRange(const AddressRange &range);
 
   void GetFDEIndex();

diff  --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index f0e161149b2f5..bae6e72a3aec9 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -750,7 +750,7 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
   /// need to use a std::unique_ptr to a llvm::once_flag so if we clear the
   /// symbol table, we can have a new once flag to use when it is created again.
   std::unique_ptr<llvm::once_flag> m_symtab_once_up;
-  llvm::Optional<uint32_t> m_cache_hash;
+  std::optional<uint32_t> m_cache_hash;
 
   /// Sets the architecture for a module.  At present the architecture can
   /// only be set if it is invalid.  It is not allowed to switch from one

diff  --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h
index b4f378f3fa5a7..d5fe0331fe5a8 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -205,7 +205,7 @@ class SymbolFile : public PluginInterface {
   /// To support variable-length array types, this function takes an
   /// optional \p ExecutionContext. If \c exe_ctx is non-null, the
   /// dynamic characteristics for that context are returned.
-  virtual llvm::Optional<ArrayInfo>
+  virtual std::optional<ArrayInfo>
   GetDynamicArrayInfoForUID(lldb::user_id_t type_uid,
                             const lldb_private::ExecutionContext *exe_ctx) = 0;
 
@@ -502,7 +502,7 @@ class SymbolFileCommon : public SymbolFile {
                                    // case it isn't the same as the module
                                    // object file (debug symbols in a separate
                                    // file)
-  llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
+  std::optional<std::vector<lldb::CompUnitSP>> m_compile_units;
   TypeList m_type_list;
   Symtab *m_symtab = nullptr;
   uint32_t m_abilities = 0;

diff  --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
index fc9c5800a5ea2..1f5b0c0902b3c 100644
--- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -97,7 +97,7 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile {
   ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
 
   lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override;
 

diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 045db47ec07da..d04a0fecd421f 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -102,7 +102,7 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
   };
 
   Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
-       llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
+       std::optional<uint64_t> byte_size, SymbolContextScope *context,
        lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type,
        const Declaration &decl, const CompilerType &compiler_qual_type,
        ResolveState compiler_type_resolve_state, uint32_t opaque_payload = 0);
@@ -138,7 +138,7 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
 
   ConstString GetBaseName();
 
-  llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
+  std::optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
 
   uint32_t GetNumChildren(bool omit_empty_base_classes);
 

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index c3b0ef85e06e8..a358d6fb13ad4 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -47,7 +47,7 @@ struct LanguageSet {
   LanguageSet();
 
   /// If the set contains a single language only, return it.
-  llvm::Optional<lldb::LanguageType> GetSingularLanguage();
+  std::optional<lldb::LanguageType> GetSingularLanguage();
   void Insert(lldb::LanguageType language);
   bool Empty() const;
   size_t Size() const;
@@ -286,7 +286,7 @@ class TypeSystem : public PluginInterface,
 
   virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
 
-  virtual llvm::Optional<uint64_t>
+  virtual std::optional<uint64_t>
   GetBitSize(lldb::opaque_compiler_type_t type,
              ExecutionContextScope *exe_scope) = 0;
 
@@ -369,7 +369,7 @@ class TypeSystem : public PluginInterface,
   virtual CompilerType
   GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
                           bool expand_pack);
-  virtual llvm::Optional<CompilerType::IntegralTemplateArgument>
+  virtual std::optional<CompilerType::IntegralTemplateArgument>
   GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
                               bool expand_pack);
 
@@ -435,7 +435,7 @@ class TypeSystem : public PluginInterface,
   virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
                              uint32_t &length) = 0;
 
-  virtual llvm::Optional<size_t>
+  virtual std::optional<size_t>
   GetTypeBitAlign(lldb::opaque_compiler_type_t type,
                   ExecutionContextScope *exe_scope) = 0;
 
@@ -517,7 +517,7 @@ class TypeSystem : public PluginInterface,
   // meaningless type itself, instead preferring to use the dynamic type
   virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
 
-  virtual llvm::Optional<llvm::json::Value> ReportStatistics();
+  virtual std::optional<llvm::json::Value> ReportStatistics();
 
   bool GetHasForcefullyCompletedTypes() const {
     return m_has_forcefully_completed_types;
@@ -575,7 +575,7 @@ class TypeSystemMap {
   /// \return The found type system or an error.
   llvm::Expected<lldb::TypeSystemSP> GetTypeSystemForLanguage(
       lldb::LanguageType language,
-      llvm::Optional<CreateCallback> create_callback = std::nullopt);
+      std::optional<CreateCallback> create_callback = std::nullopt);
   };
 
 } // namespace lldb_private

diff  --git a/lldb/include/lldb/Symbol/UnwindTable.h b/lldb/include/lldb/Symbol/UnwindTable.h
index b5e56d3d83b2a..a3026504dbdfe 100644
--- a/lldb/include/lldb/Symbol/UnwindTable.h
+++ b/lldb/include/lldb/Symbol/UnwindTable.h
@@ -61,8 +61,8 @@ class UnwindTable {
   void Dump(Stream &s);
 
   void Initialize();
-  llvm::Optional<AddressRange> GetAddressRange(const Address &addr,
-                                               SymbolContext &sc);
+  std::optional<AddressRange> GetAddressRange(const Address &addr,
+                                              SymbolContext &sc);
 
   typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection;
   typedef collection::iterator iterator;

diff  --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h
index 5cd779fa0dc02..9cc79dc976c4d 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -151,7 +151,7 @@ class LanguageRuntime : public Runtime, public PluginInterface {
   /// from the user interface.
   virtual bool IsAllowedRuntimeValue(ConstString name) { return false; }
 
-  virtual llvm::Optional<CompilerType> GetRuntimeType(CompilerType base_type) {
+  virtual std::optional<CompilerType> GetRuntimeType(CompilerType base_type) {
     return std::nullopt;
   }
 

diff  --git a/lldb/include/lldb/Target/MemoryRegionInfo.h b/lldb/include/lldb/Target/MemoryRegionInfo.h
index 1bb705474298f..8d639a86700e0 100644
--- a/lldb/include/lldb/Target/MemoryRegionInfo.h
+++ b/lldb/include/lldb/Target/MemoryRegionInfo.h
@@ -121,7 +121,7 @@ class MemoryRegionInfo {
   /// modified -- within this memory region.  This is an Optional return
   /// value; it will only be available if the remote stub was able to
   /// detail this.
-  const llvm::Optional<std::vector<lldb::addr_t>> &GetDirtyPageList() const {
+  const std::optional<std::vector<lldb::addr_t>> &GetDirtyPageList() const {
     return m_dirty_pages;
   }
 
@@ -150,7 +150,7 @@ class MemoryRegionInfo {
   OptionalBool m_memory_tagged = eDontKnow;
   OptionalBool m_is_stack_memory = eDontKnow;
   int m_pagesize = 0;
-  llvm::Optional<std::vector<lldb::addr_t>> m_dirty_pages;
+  std::optional<std::vector<lldb::addr_t>> m_dirty_pages;
 };
   
 inline bool operator<(const MemoryRegionInfo &lhs,

diff  --git a/lldb/include/lldb/Target/MemoryTagMap.h b/lldb/include/lldb/Target/MemoryTagMap.h
index 953eb3224205e..00543bbfe6082 100644
--- a/lldb/include/lldb/Target/MemoryTagMap.h
+++ b/lldb/include/lldb/Target/MemoryTagMap.h
@@ -67,8 +67,8 @@ class MemoryTagMap {
   ///    If some of the range was tagged it will have items and some
   ///    of them may be std::nullopt.
   ///    (this saves the caller checking whether all items are std::nullopt)
-  std::vector<llvm::Optional<lldb::addr_t>> GetTags(lldb::addr_t addr,
-                                                    size_t len) const;
+  std::vector<std::optional<lldb::addr_t>> GetTags(lldb::addr_t addr,
+                                                   size_t len) const;
 
 private:
   /// Lookup the tag for address
@@ -80,7 +80,7 @@ class MemoryTagMap {
   /// \return
   ///     The tag for the granule that address refers to, or std::nullopt
   ///     if it has no memory tag.
-  llvm::Optional<lldb::addr_t> GetTag(lldb::addr_t addr) const;
+  std::optional<lldb::addr_t> GetTag(lldb::addr_t addr) const;
 
   // A map of granule aligned addresses to their memory tag
   std::map<lldb::addr_t, lldb::addr_t> m_addr_to_tag;
@@ -88,7 +88,7 @@ class MemoryTagMap {
   // Memory tag manager used to align addresses and get granule size.
   // Ideally this would be a const& but only certain architectures will
   // have a memory tag manager class to provide here. So for a method
-  // returning a MemoryTagMap, Optional<MemoryTagMap> allows it to handle
+  // returning a MemoryTagMap, std::optional<MemoryTagMap> allows it to handle
   // architectures without memory tagging. Optionals cannot hold references
   // so we go with a pointer that we assume will be not be null.
   const MemoryTagManager *m_manager;

diff  --git a/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h
index 37267d9589fa7..447fb43f4d6dc 100644
--- a/lldb/include/lldb/Target/PathMappingList.h
+++ b/lldb/include/lldb/Target/PathMappingList.h
@@ -90,8 +90,8 @@ class PathMappingList {
   ///
   /// \return
   ///     The remapped filespec that may or may not exist on disk.
-  llvm::Optional<FileSpec> RemapPath(llvm::StringRef path,
-                                     bool only_if_exists = false) const;
+  std::optional<FileSpec> RemapPath(llvm::StringRef path,
+                                    bool only_if_exists = false) const;
   bool RemapPath(const char *, std::string &) const = delete;
 
   /// Perform reverse source path remap for input \a file.
@@ -108,8 +108,8 @@ class PathMappingList {
   ///     std::nullopt if no remapping happens, otherwise, the matching source
   ///     map entry's ""to_new_pathto"" part (which is the prefix of \a file) is
   ///     returned.
-  llvm::Optional<llvm::StringRef> ReverseRemapPath(const FileSpec &file,
-                                                   FileSpec &fixed) const;
+  std::optional<llvm::StringRef> ReverseRemapPath(const FileSpec &file,
+                                                  FileSpec &fixed) const;
 
   /// Finds a source file given a file spec using the path remappings.
   ///
@@ -124,7 +124,7 @@ class PathMappingList {
   ///
   /// \return
   ///     The newly remapped filespec that is guaranteed to exist.
-  llvm::Optional<FileSpec> FindFile(const FileSpec &orig_spec) const;
+  std::optional<FileSpec> FindFile(const FileSpec &orig_spec) const;
 
   uint32_t FindIndexForPath(llvm::StringRef path) const;
 

diff  --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index c4073b162b966..08e47cc132473 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -204,9 +204,9 @@ class Platform : public PluginInterface {
 
   bool SetOSVersion(llvm::VersionTuple os_version);
 
-  llvm::Optional<std::string> GetOSBuildString();
+  std::optional<std::string> GetOSBuildString();
 
-  llvm::Optional<std::string> GetOSKernelDescription();
+  std::optional<std::string> GetOSKernelDescription();
 
   // Returns the name of the platform
   llvm::StringRef GetName() { return GetPluginName(); }
@@ -232,11 +232,11 @@ class Platform : public PluginInterface {
   // HostInfo::GetOSVersion().
   virtual bool GetRemoteOSVersion() { return false; }
 
-  virtual llvm::Optional<std::string> GetRemoteOSBuildString() {
+  virtual std::optional<std::string> GetRemoteOSBuildString() {
     return std::nullopt;
   }
 
-  virtual llvm::Optional<std::string> GetRemoteOSKernelDescription() {
+  virtual std::optional<std::string> GetRemoteOSKernelDescription() {
     return std::nullopt;
   }
 

diff  --git a/lldb/include/lldb/Target/RemoteAwarePlatform.h b/lldb/include/lldb/Target/RemoteAwarePlatform.h
index 8354b49830251..d183815e1c8b0 100644
--- a/lldb/include/lldb/Target/RemoteAwarePlatform.h
+++ b/lldb/include/lldb/Target/RemoteAwarePlatform.h
@@ -65,8 +65,8 @@ class RemoteAwarePlatform : public Platform {
                          FileSpec &local_file) override;
 
   bool GetRemoteOSVersion() override;
-  llvm::Optional<std::string> GetRemoteOSBuildString() override;
-  llvm::Optional<std::string> GetRemoteOSKernelDescription() override;
+  std::optional<std::string> GetRemoteOSBuildString() override;
+  std::optional<std::string> GetRemoteOSKernelDescription() override;
   ArchSpec GetRemoteSystemArchitecture() override;
 
   Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir,

diff  --git a/lldb/include/lldb/Target/StackFrameRecognizer.h b/lldb/include/lldb/Target/StackFrameRecognizer.h
index e14df80f2497d..419f0c0aac1f8 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -155,7 +155,7 @@ class ValueObjectRecognizerSynthesizedValue : public ValueObject {
     SetName(parent.GetName());
   }
 
-  llvm::Optional<uint64_t> GetByteSize() override {
+  std::optional<uint64_t> GetByteSize() override {
     return m_parent->GetByteSize();
   }
   lldb::ValueType GetValueType() const override { return m_type; }

diff  --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h
index 2be51acd19d89..f672786f58f84 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -146,9 +146,9 @@ class TargetStats {
 
 protected:
   StatsDuration m_create_time;
-  llvm::Optional<StatsTimepoint> m_launch_or_attach_time;
-  llvm::Optional<StatsTimepoint> m_first_private_stop_time;
-  llvm::Optional<StatsTimepoint> m_first_public_stop_time;
+  std::optional<StatsTimepoint> m_launch_or_attach_time;
+  std::optional<StatsTimepoint> m_first_private_stop_time;
+  std::optional<StatsTimepoint> m_first_public_stop_time;
   StatsSuccessFail m_expr_eval{"expressionEvaluation"};
   StatsSuccessFail m_frame_var{"frameVariable"};
   std::vector<intptr_t> m_module_identifiers;

diff  --git a/lldb/include/lldb/Target/Trace.h b/lldb/include/lldb/Target/Trace.h
index bf6b24fe681f2..fc67a0e05ab44 100644
--- a/lldb/include/lldb/Target/Trace.h
+++ b/lldb/include/lldb/Target/Trace.h
@@ -465,19 +465,19 @@ class Trace : public PluginInterface,
   GetLiveProcessBinaryData(llvm::StringRef kind);
 
   /// Get the size of the data returned by \a GetLiveThreadBinaryData
-  llvm::Optional<uint64_t> GetLiveThreadBinaryDataSize(lldb::tid_t tid,
-                                                       llvm::StringRef kind);
+  std::optional<uint64_t> GetLiveThreadBinaryDataSize(lldb::tid_t tid,
+                                                      llvm::StringRef kind);
 
   /// Get the size of the data returned by \a GetLiveCpuBinaryData
-  llvm::Optional<uint64_t> GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
-                                                    llvm::StringRef kind);
+  std::optional<uint64_t> GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
+                                                   llvm::StringRef kind);
 
   /// Get the size of the data returned by \a GetLiveProcessBinaryData
-  llvm::Optional<uint64_t> GetLiveProcessBinaryDataSize(llvm::StringRef kind);
+  std::optional<uint64_t> GetLiveProcessBinaryDataSize(llvm::StringRef kind);
 
   /// Constructor for post mortem processes
   Trace(llvm::ArrayRef<lldb::ProcessSP> postmortem_processes,
-        llvm::Optional<std::vector<lldb::cpu_id_t>> postmortem_cpus);
+        std::optional<std::vector<lldb::cpu_id_t>> postmortem_cpus);
 
   /// Constructor for a live process
   Trace(Process &live_process) : m_live_process(&live_process) {}
@@ -572,7 +572,7 @@ class Trace : public PluginInterface,
 
     /// The list of cpus being traced. Might be \b None depending on the
     /// plug-in.
-    llvm::Optional<std::vector<lldb::cpu_id_t>> cpus;
+    std::optional<std::vector<lldb::cpu_id_t>> cpus;
 
     /// Postmortem traces can specific additional data files, which are
     /// represented in this variable using a data kind identifier for each file.
@@ -588,7 +588,7 @@ class Trace : public PluginInterface,
 
     /// \}
 
-    llvm::Optional<std::string> live_refresh_error;
+    std::optional<std::string> live_refresh_error;
   } m_storage;
 
   /// Get the storage after refreshing the data in the case of a live process.

diff  --git a/lldb/include/lldb/Target/TraceCursor.h b/lldb/include/lldb/Target/TraceCursor.h
index 576b3707909ce..cfc25b0cedc90 100644
--- a/lldb/include/lldb/Target/TraceCursor.h
+++ b/lldb/include/lldb/Target/TraceCursor.h
@@ -271,7 +271,7 @@ class TraceCursor {
   /// \return
   ///     The approximate wall clock time for the trace item, or \a std::nullopt
   ///     if not available.
-  virtual llvm::Optional<double> GetWallClockTime() const = 0;
+  virtual std::optional<double> GetWallClockTime() const = 0;
 
   /// Get some metadata associated with a synchronization point event. As
   /// 
diff erent trace technologies might have 
diff erent values for this,

diff  --git a/lldb/include/lldb/Target/TraceDumper.h b/lldb/include/lldb/Target/TraceDumper.h
index 4a8fbf8fc7430..72dcf64a05ef0 100644
--- a/lldb/include/lldb/Target/TraceDumper.h
+++ b/lldb/include/lldb/Target/TraceDumper.h
@@ -39,10 +39,10 @@ struct TraceDumperOptions {
   /// For each instruction, print the instruction kind.
   bool show_control_flow_kind = false;
   /// Optional custom id to start traversing from.
-  llvm::Optional<uint64_t> id = std::nullopt;
+  std::optional<uint64_t> id = std::nullopt;
   /// Optional number of instructions to skip from the starting position
   /// of the cursor.
-  llvm::Optional<size_t> skip = std::nullopt;
+  std::optional<size_t> skip = std::nullopt;
 };
 
 /// Class used to dump the instructions of a \a TraceCursor using its current
@@ -63,13 +63,13 @@ class TraceDumper {
   struct TraceItem {
     lldb::user_id_t id;
     lldb::addr_t load_address;
-    llvm::Optional<double> timestamp;
+    std::optional<double> timestamp;
     std::optional<uint64_t> hw_clock;
     std::optional<std::string> sync_point_metadata;
-    llvm::Optional<llvm::StringRef> error;
-    llvm::Optional<lldb::TraceEvent> event;
-    llvm::Optional<SymbolInfo> symbol_info;
-    llvm::Optional<SymbolInfo> prev_symbol_info;
+    std::optional<llvm::StringRef> error;
+    std::optional<lldb::TraceEvent> event;
+    std::optional<SymbolInfo> symbol_info;
+    std::optional<SymbolInfo> prev_symbol_info;
     std::optional<lldb::cpu_id_t> cpu_id;
   };
 
@@ -350,7 +350,8 @@ class TraceDumper {
 
     /// \return
     ///   A optional to the untraced prefix segment of this call.
-    const llvm::Optional<UntracedPrefixSegment> &GetUntracedPrefixSegment() const;
+    const std::optional<UntracedPrefixSegment> &
+    GetUntracedPrefixSegment() const;
 
     /// \return
     ///   A pointer to the parent call. It may be \b nullptr.
@@ -360,7 +361,7 @@ class TraceDumper {
 
   private:
     /// An optional untraced segment that precedes all the traced segments.
-    llvm::Optional<UntracedPrefixSegment> m_untraced_prefix_segment;
+    std::optional<UntracedPrefixSegment> m_untraced_prefix_segment;
     /// The traced segments in order. We used a deque to prevent moving these
     /// objects when appending to the list, which would happen with vector.
     std::deque<TracedSegment> m_traced_segments;
@@ -413,7 +414,7 @@ class TraceDumper {
   /// \return
   ///     The instruction id of the last traversed instruction, or \b
   ///     std::nullopt if no instructions were visited.
-  llvm::Optional<lldb::user_id_t> DumpInstructions(size_t count);
+  std::optional<lldb::user_id_t> DumpInstructions(size_t count);
 
   /// Dump all function calls forwards chronologically and hierarchically
   void DumpFunctionCalls();

diff  --git a/lldb/include/lldb/Target/UnixSignals.h b/lldb/include/lldb/Target/UnixSignals.h
index 52761ae7dadce..c9967239d4da6 100644
--- a/lldb/include/lldb/Target/UnixSignals.h
+++ b/lldb/include/lldb/Target/UnixSignals.h
@@ -105,9 +105,9 @@ class UnixSignals {
   // should_[suppress|stop|notify] flag can be std::nullopt - no filtering by
   // this flag true - only signals that have it set to true are returned false -
   // only signals that have it set to true are returned
-  std::vector<int32_t> GetFilteredSignals(llvm::Optional<bool> should_suppress,
-                                          llvm::Optional<bool> should_stop,
-                                          llvm::Optional<bool> should_notify);
+  std::vector<int32_t> GetFilteredSignals(std::optional<bool> should_suppress,
+                                          std::optional<bool> should_stop,
+                                          std::optional<bool> should_notify);
 
 protected:
   // Classes that inherit from UnixSignals can see and modify these

diff  --git a/lldb/include/lldb/Utility/Diagnostics.h b/lldb/include/lldb/Utility/Diagnostics.h
index f9246f15c7bca..225346a5127ea 100644
--- a/lldb/include/lldb/Utility/Diagnostics.h
+++ b/lldb/include/lldb/Utility/Diagnostics.h
@@ -56,7 +56,7 @@ class Diagnostics {
   static llvm::Expected<FileSpec> CreateUniqueDirectory();
 
 private:
-  static llvm::Optional<Diagnostics> &InstanceImpl();
+  static std::optional<Diagnostics> &InstanceImpl();
 
   llvm::Error DumpDiangosticsLog(const FileSpec &dir) const;
 

diff  --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index b19186596bf85..e4d3d12979c21 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -195,7 +195,7 @@ class FileSpec {
   /// The guess will be correct if the input path was a valid absolute path on
   /// the system which produced it. On other paths the result of this function
   /// is unreliable (e.g. "c:\foo.txt" is a valid relative posix path).
-  static llvm::Optional<Style> GuessPathStyle(llvm::StringRef absolute_path);
+  static std::optional<Style> GuessPathStyle(llvm::StringRef absolute_path);
 
   /// Case sensitivity of path.
   ///

diff  --git a/lldb/include/lldb/Utility/Predicate.h b/lldb/include/lldb/Utility/Predicate.h
index 5d598fb3e0daf..3338d08ca520d 100644
--- a/lldb/include/lldb/Utility/Predicate.h
+++ b/lldb/include/lldb/Utility/Predicate.h
@@ -120,7 +120,7 @@ template <class T> class Predicate {
   ///     m_value if Cond(m_value) is true, std::nullopt otherwise (timeout
   ///     occurred).
   template <typename C>
-  llvm::Optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) {
+  std::optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) {
     std::unique_lock<std::mutex> lock(m_mutex);
     auto RealCond = [&] { return Cond(m_value); };
     if (!timeout) {
@@ -181,7 +181,7 @@ template <class T> class Predicate {
   /// \return
   ///     m_value if m_value != value, std::nullopt otherwise (timeout
   ///     occurred).
-  llvm::Optional<T>
+  std::optional<T>
   WaitForValueNotEqualTo(T value,
                          const Timeout<std::micro> &timeout = std::nullopt) {
     return WaitFor([&value](T current) { return value != current; }, timeout);

diff  --git a/lldb/include/lldb/Utility/SelectHelper.h b/lldb/include/lldb/Utility/SelectHelper.h
index c2963d882f26d..c1263f7c5643f 100644
--- a/lldb/include/lldb/Utility/SelectHelper.h
+++ b/lldb/include/lldb/Utility/SelectHelper.h
@@ -66,7 +66,7 @@ class SelectHelper {
         write_is_set : 1, error_is_set : 1;
   };
   llvm::DenseMap<lldb::socket_t, FDInfo> m_fd_map;
-  llvm::Optional<std::chrono::steady_clock::time_point> m_end_time;
+  std::optional<std::chrono::steady_clock::time_point> m_end_time;
 };
 
 #endif // LLDB_UTILITY_SELECTHELPER_H

diff  --git a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
index 6f8c34b49b2fb..dd468ef5bddef 100644
--- a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
+++ b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
@@ -211,7 +211,7 @@ class StringExtractorGDBRemote : public StringExtractor {
   // Read thread-id from the packet.  If the packet is valid, returns
   // the pair (PID, TID), otherwise returns std::nullopt.  If the packet
   // does not list a PID, default_pid is used.
-  llvm::Optional<std::pair<lldb::pid_t, lldb::tid_t>>
+  std::optional<std::pair<lldb::pid_t, lldb::tid_t>>
   GetPidTid(lldb::pid_t default_pid);
 
 protected:

diff  --git a/lldb/include/lldb/Utility/Timeout.h b/lldb/include/lldb/Utility/Timeout.h
index 603cf06a966cf..3f7744ed3ab86 100644
--- a/lldb/include/lldb/Utility/Timeout.h
+++ b/lldb/include/lldb/Utility/Timeout.h
@@ -17,7 +17,7 @@
 namespace lldb_private {
 
 // A general purpose class for representing timeouts for various APIs. It's
-// basically an llvm::Optional<std::chrono::duration<int64_t, Ratio>>, but we
+// basically an std::optional<std::chrono::duration<int64_t, Ratio>>, but we
 // customize it a bit to enable the standard chrono implicit conversions (e.g.
 // from Timeout<std::milli> to Timeout<std::micro>.
 //
@@ -26,7 +26,7 @@ namespace lldb_private {
 // complete the call if it will not block - >0 - wait for a given number of
 // units for the result
 template <typename Ratio>
-class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
+class Timeout : public std::optional<std::chrono::duration<int64_t, Ratio>> {
 private:
   template <typename Ratio2> using Dur = std::chrono::duration<int64_t, Ratio2>;
   template <typename Rep2, typename Ratio2>
@@ -34,7 +34,7 @@ class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
       std::is_convertible<std::chrono::duration<Rep2, Ratio2>,
                           std::chrono::duration<int64_t, Ratio>>::value>;
 
-  using Base = llvm::Optional<Dur<Ratio>>;
+  using Base = std::optional<Dur<Ratio>>;
 
 public:
   Timeout(std::nullopt_t none) : Base(none) {}

diff  --git a/lldb/include/lldb/Utility/UriParser.h b/lldb/include/lldb/Utility/UriParser.h
index 2722b4ac86db9..b1092219d4748 100644
--- a/lldb/include/lldb/Utility/UriParser.h
+++ b/lldb/include/lldb/Utility/UriParser.h
@@ -22,7 +22,7 @@ namespace lldb_private {
 struct URI {
   llvm::StringRef scheme;
   llvm::StringRef hostname;
-  llvm::Optional<uint16_t> port;
+  std::optional<uint16_t> port;
   llvm::StringRef path;
 
   bool operator==(const URI &R) const {
@@ -30,7 +30,7 @@ struct URI {
            path == R.path;
   }
 
-  static llvm::Optional<URI> Parse(llvm::StringRef uri);
+  static std::optional<URI> Parse(llvm::StringRef uri);
 };
 
 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const URI &U);

diff  --git a/lldb/include/lldb/Utility/UserIDResolver.h b/lldb/include/lldb/Utility/UserIDResolver.h
index 7caa0a1442c44..e9f58367a39b9 100644
--- a/lldb/include/lldb/Utility/UserIDResolver.h
+++ b/lldb/include/lldb/Utility/UserIDResolver.h
@@ -26,10 +26,10 @@ class UserIDResolver {
   typedef uint32_t id_t;
   virtual ~UserIDResolver(); // anchor
 
-  llvm::Optional<llvm::StringRef> GetUserName(id_t uid) {
+  std::optional<llvm::StringRef> GetUserName(id_t uid) {
     return Get(uid, m_uid_cache, &UserIDResolver::DoGetUserName);
   }
-  llvm::Optional<llvm::StringRef> GetGroupName(id_t gid) {
+  std::optional<llvm::StringRef> GetGroupName(id_t gid) {
     return Get(gid, m_gid_cache, &UserIDResolver::DoGetGroupName);
   }
 
@@ -38,15 +38,15 @@ class UserIDResolver {
   static UserIDResolver &GetNoopResolver();
 
 protected:
-  virtual llvm::Optional<std::string> DoGetUserName(id_t uid) = 0;
-  virtual llvm::Optional<std::string> DoGetGroupName(id_t gid) = 0;
+  virtual std::optional<std::string> DoGetUserName(id_t uid) = 0;
+  virtual std::optional<std::string> DoGetGroupName(id_t gid) = 0;
 
 private:
-  using Map = llvm::DenseMap<id_t, llvm::Optional<std::string>>;
+  using Map = llvm::DenseMap<id_t, std::optional<std::string>>;
 
-  llvm::Optional<llvm::StringRef>
+  std::optional<llvm::StringRef>
   Get(id_t id, Map &cache,
-      llvm::Optional<std::string> (UserIDResolver::*do_get)(id_t));
+      std::optional<std::string> (UserIDResolver::*do_get)(id_t));
 
   std::mutex m_mutex;
   Map m_uid_cache;

diff  --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 5a48dc8b35a39..cd6ef3b23fd41 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -47,7 +47,7 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
     m_auto_repeat_command =
         auto_repeat_command == nullptr
             ? std::nullopt
-            : llvm::Optional<std::string>(auto_repeat_command);
+            : std::optional<std::string>(auto_repeat_command);
     // We don't know whether any given command coming from this interface takes
     // arguments or not so here we're just disabling the basic args check.
     CommandArgumentData none_arg{eArgTypeNone, eArgRepeatStar};
@@ -60,8 +60,8 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
   /// but in short, if std::nullopt is returned, the previous command will be
   /// repeated, and if an empty string is returned, no commands will be
   /// executed.
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     if (!m_auto_repeat_command)
       return std::nullopt;
     else
@@ -78,7 +78,7 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
     return ret;
   }
   std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
-  llvm::Optional<std::string> m_auto_repeat_command;
+  std::optional<std::string> m_auto_repeat_command;
 };
 
 SBCommandInterpreter::SBCommandInterpreter(CommandInterpreter *interpreter)

diff  --git a/lldb/source/API/SBMemoryRegionInfo.cpp b/lldb/source/API/SBMemoryRegionInfo.cpp
index bf2db7b7c7e05..cd25be5d52769 100644
--- a/lldb/source/API/SBMemoryRegionInfo.cpp
+++ b/lldb/source/API/SBMemoryRegionInfo.cpp
@@ -134,7 +134,7 @@ uint32_t SBMemoryRegionInfo::GetNumDirtyPages() {
   LLDB_INSTRUMENT_VA(this);
 
   uint32_t num_dirty_pages = 0;
-  const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
+  const std::optional<std::vector<addr_t>> &dirty_page_list =
       m_opaque_up->GetDirtyPageList();
   if (dirty_page_list)
     num_dirty_pages = dirty_page_list->size();
@@ -146,7 +146,7 @@ addr_t SBMemoryRegionInfo::GetDirtyPageAddressAtIndex(uint32_t idx) {
   LLDB_INSTRUMENT_VA(this, idx);
 
   addr_t dirty_page_addr = LLDB_INVALID_ADDRESS;
-  const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
+  const std::optional<std::vector<addr_t>> &dirty_page_list =
       m_opaque_up->GetDirtyPageList();
   if (dirty_page_list && idx < dirty_page_list->size())
     dirty_page_addr = (*dirty_page_list)[idx];

diff  --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 98700997a8190..1ccc3b0c2dc9d 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -121,7 +121,7 @@ uint64_t SBType::GetByteSize() {
   LLDB_INSTRUMENT_VA(this);
 
   if (IsValid())
-    if (llvm::Optional<uint64_t> size =
+    if (std::optional<uint64_t> size =
             m_opaque_sp->GetCompilerType(false).GetByteSize(nullptr))
       return *size;
   return 0;

diff  --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp
index 12562ee4fed1b..958c2dbe300c1 100644
--- a/lldb/source/Breakpoint/BreakpointID.cpp
+++ b/lldb/source/Breakpoint/BreakpointID.cpp
@@ -63,7 +63,7 @@ void BreakpointID::GetCanonicalReference(Stream *s, break_id_t bp_id,
     s->Printf("%i.%i", bp_id, loc_id);
 }
 
-llvm::Optional<BreakpointID>
+std::optional<BreakpointID>
 BreakpointID::ParseCanonicalReference(llvm::StringRef input) {
   break_id_t bp_id;
   break_id_t loc_id = LLDB_INVALID_BREAK_ID;

diff  --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp
index b1ee7902c0316..5c03798a7427e 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -181,7 +181,7 @@ namespace {
 struct SourceLoc {
   uint32_t line = UINT32_MAX;
   uint16_t column;
-  SourceLoc(uint32_t l, llvm::Optional<uint16_t> c)
+  SourceLoc(uint32_t l, std::optional<uint16_t> c)
       : line(l), column(c ? *c : LLDB_INVALID_COLUMN_NUMBER) {}
   SourceLoc(const SymbolContext &sc)
       : line(sc.line_entry.line),
@@ -202,7 +202,7 @@ bool operator<(const SourceLoc lhs, const SourceLoc rhs) {
 
 void BreakpointResolver::SetSCMatchesByLine(
     SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue,
-    llvm::StringRef log_ident, uint32_t line, llvm::Optional<uint16_t> column) {
+    llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
   llvm::SmallVector<SymbolContext, 16> all_scs;
   for (uint32_t i = 0; i < sc_list.GetSize(); ++i)
     all_scs.push_back(sc_list[i]);

diff  --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index 4b108a01cf77f..890b38af5c88d 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -25,7 +25,7 @@ using namespace lldb_private;
 BreakpointResolverFileLine::BreakpointResolverFileLine(
     const BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue,
     const SourceLocationSpec &location_spec,
-    llvm::Optional<llvm::StringRef> removed_prefix_opt)
+    std::optional<llvm::StringRef> removed_prefix_opt)
     : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset),
       m_location_spec(location_spec), m_skip_prologue(skip_prologue),
       m_removed_prefix_opt(removed_prefix_opt) {}
@@ -205,7 +205,7 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
   // of "a" after consuming "b" from the back.
   auto check_suffix =
       [path_separator](llvm::StringRef a, llvm::StringRef b,
-                       bool case_sensitive) -> llvm::Optional<llvm::StringRef> {
+                       bool case_sensitive) -> std::optional<llvm::StringRef> {
     if (case_sensitive ? a.consume_back(b) : a.consume_back_insensitive(b)) {
       if (a.empty() || a.endswith(path_separator)) {
         return a;
@@ -244,14 +244,14 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
     if (m_removed_prefix_opt.has_value())
       llvm::sys::path::append(new_mapping_to, *m_removed_prefix_opt);
 
-    llvm::Optional<llvm::StringRef> new_mapping_from_opt =
+    std::optional<llvm::StringRef> new_mapping_from_opt =
         check_suffix(sc_file_dir, request_file_dir, case_sensitive);
     if (new_mapping_from_opt) {
       new_mapping_from = *new_mapping_from_opt;
       if (new_mapping_to.empty())
         new_mapping_to = ".";
     } else {
-      llvm::Optional<llvm::StringRef> new_mapping_to_opt =
+      std::optional<llvm::StringRef> new_mapping_to_opt =
           check_suffix(request_file_dir, sc_file_dir, case_sensitive);
       if (new_mapping_to_opt) {
         new_mapping_from = ".";
@@ -291,7 +291,7 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback(
   // same file spec in their line_entry and treat each set separately.
 
   const uint32_t line = m_location_spec.GetLine().value_or(0);
-  const llvm::Optional<uint16_t> column = m_location_spec.GetColumn();
+  const std::optional<uint16_t> column = m_location_spec.GetColumn();
 
   const size_t num_comp_units = context.module_sp->GetNumCompileUnits();
   for (size_t i = 0; i < num_comp_units; i++) {

diff  --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 8665a44535bda..2680c113c3b49 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -2205,7 +2205,7 @@ class CommandObjectBreakpointRead : public CommandObjectParsed {
         break;
 
       case 'N':
-        llvm::Optional<FileSpec> file_spec;
+        std::optional<FileSpec> file_spec;
         const llvm::StringRef dash_f("-f");
         for (int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
           if (dash_f == request.GetParsedLine().GetArgumentAtIndex(arg_idx)) {

diff  --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 5f9d699fceedc..6f3b2927ded8e 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -58,8 +58,8 @@ class CommandObjectCommandsSource : public CommandObjectParsed {
 
   ~CommandObjectCommandsSource() override = default;
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     return std::string("");
   }
 

diff  --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 29d5c236a4d1c..af0f94ad6417a 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -100,9 +100,9 @@ class CommandObjectFrameDiagnose : public CommandObjectParsed {
     }
 
     // Options.
-    llvm::Optional<lldb::addr_t> address;
-    llvm::Optional<ConstString> reg;
-    llvm::Optional<int64_t> offset;
+    std::optional<lldb::addr_t> address;
+    std::optional<ConstString> reg;
+    std::optional<int64_t> offset;
   };
 
   CommandObjectFrameDiagnose(CommandInterpreter &interpreter)
@@ -257,7 +257,7 @@ class CommandObjectFrameSelect : public CommandObjectParsed {
       return llvm::makeArrayRef(g_frame_select_options);
     }
 
-    llvm::Optional<int32_t> relative_frame_offset;
+    std::optional<int32_t> relative_frame_offset;
   };
 
   CommandObjectFrameSelect(CommandInterpreter &interpreter)

diff  --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index fa0c96f4535f8..78ee647c046af 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -342,8 +342,8 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
 
   Options *GetOptions() override { return &m_option_group; }
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     return m_cmd_name;
   }
 
@@ -477,7 +477,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
         for (auto lang : languages_to_check) {
           if (auto *persistent_vars =
                   target->GetPersistentExpressionStateForLanguage(lang)) {
-            if (llvm::Optional<CompilerType> type =
+            if (std::optional<CompilerType> type =
                     persistent_vars->GetCompilerTypeFromPersistentDecl(
                         lookup_type_name)) {
               user_defined_types.emplace(*type);
@@ -522,7 +522,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
         --pointer_count;
       }
 
-      llvm::Optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
+      std::optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
       if (!size) {
         result.AppendErrorWithFormat(
             "unable to get the byte size of the type '%s'\n",
@@ -651,7 +651,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
       if (!m_format_options.GetFormatValue().OptionWasSet())
         m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
 
-      llvm::Optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
+      std::optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
       if (!size) {
         result.AppendError("can't get size of type");
         return false;
@@ -1076,7 +1076,7 @@ class CommandObjectMemoryFind : public CommandObjectParsed {
                m_memory_options.m_expr.GetStringValue(), frame, result_sp)) &&
           result_sp) {
         uint64_t value = result_sp->GetValueAsUnsigned(0);
-        llvm::Optional<uint64_t> size =
+        std::optional<uint64_t> size =
             result_sp->GetCompilerType().GetByteSize(nullptr);
         if (!size)
           return false;
@@ -1601,8 +1601,8 @@ class CommandObjectMemoryHistory : public CommandObjectParsed {
 
   ~CommandObjectMemoryHistory() override = default;
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     return m_cmd_name;
   }
 
@@ -1737,7 +1737,7 @@ class CommandObjectMemoryRegion : public CommandObjectParsed {
     if (memory_tagged == MemoryRegionInfo::OptionalBool::eYes)
       result.AppendMessage("memory tagging: enabled");
 
-    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_page_list) {
       const size_t page_count = dirty_page_list->size();
@@ -1852,8 +1852,8 @@ class CommandObjectMemoryRegion : public CommandObjectParsed {
     return false;
   }
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     // If we repeat this command, repeat it without any arguments so we can
     // show the next memory range
     return m_cmd_name;

diff  --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index 80682b09722ef..6bcf0dea03868 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -291,7 +291,7 @@ void CommandObjectMultiword::HandleCompletion(CompletionRequest &request) {
   sub_command_object->HandleCompletion(request);
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 CommandObjectMultiword::GetRepeatCommand(Args &current_command_args,
                                          uint32_t index) {
   index++;
@@ -421,7 +421,7 @@ void CommandObjectProxy::HandleArgumentCompletion(
     proxy_command->HandleArgumentCompletion(request, opt_element_vector);
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 CommandObjectProxy::GetRepeatCommand(Args &current_command_args,
                                      uint32_t index) {
   CommandObject *proxy_command = GetProxyCommandObject();

diff  --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 66a90d5a2b635..3532948560834 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -152,8 +152,8 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
 
   Options *GetOptions() override { return &m_all_options; }
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     // No repeat for "process launch"...
     return std::string("");
   }

diff  --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 2c84e6fe156fa..049b02b13e068 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -722,8 +722,8 @@ class CommandObjectSourceList : public CommandObjectParsed {
 
   Options *GetOptions() override { return &m_options; }
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     // This is kind of gross, but the command hasn't been parsed yet so we
     // can't look at the option values for this invocation...  I have to scan
     // the arguments directly.

diff  --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 5c4674d683e59..750bf74756f95 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -125,8 +125,8 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
 
   Options *GetOptions() override { return &m_options; }
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_args,
-                                               uint32_t idx) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_args,
+                                              uint32_t idx) override {
     llvm::StringRef count_opt("--count");
     llvm::StringRef start_opt("--start");
 
@@ -2161,7 +2161,7 @@ class CommandObjectTraceDumpFunctionCalls : public CommandObjectParsed {
 
     // Instance variables to hold the values for command options.
     TraceDumperOptions m_dumper_options;
-    llvm::Optional<FileSpec> m_output_file;
+    std::optional<FileSpec> m_output_file;
   };
 
   CommandObjectTraceDumpFunctionCalls(CommandInterpreter &interpreter)
@@ -2198,7 +2198,7 @@ class CommandObjectTraceDumpFunctionCalls : public CommandObjectParsed {
     }
     TraceCursorSP &cursor_sp = *cursor_or_error;
 
-    llvm::Optional<StreamFile> out_file;
+    std::optional<StreamFile> out_file;
     if (m_options.m_output_file) {
       out_file.emplace(m_options.m_output_file->GetPath().c_str(),
                        File::eOpenOptionWriteOnly | File::eOpenOptionCanCreate |
@@ -2335,7 +2335,7 @@ class CommandObjectTraceDumpInstructions : public CommandObjectParsed {
     // Instance variables to hold the values for command options.
     size_t m_count;
     size_t m_continue;
-    llvm::Optional<FileSpec> m_output_file;
+    std::optional<FileSpec> m_output_file;
     TraceDumperOptions m_dumper_options;
   };
 
@@ -2356,8 +2356,8 @@ class CommandObjectTraceDumpInstructions : public CommandObjectParsed {
 
   Options *GetOptions() override { return &m_options; }
 
-  llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
-                                               uint32_t index) override {
+  std::optional<std::string> GetRepeatCommand(Args &current_command_args,
+                                              uint32_t index) override {
     std::string cmd;
     current_command_args.GetCommandString(cmd);
     if (cmd.find(" --continue") == std::string::npos)
@@ -2395,7 +2395,7 @@ class CommandObjectTraceDumpInstructions : public CommandObjectParsed {
       return false;
     }
 
-    llvm::Optional<StreamFile> out_file;
+    std::optional<StreamFile> out_file;
     if (m_options.m_output_file) {
       out_file.emplace(m_options.m_output_file->GetPath().c_str(),
                        File::eOpenOptionWriteOnly | File::eOpenOptionCanCreate |
@@ -2420,7 +2420,7 @@ class CommandObjectTraceDumpInstructions : public CommandObjectParsed {
   CommandOptions m_options;
   // Last traversed id used to continue a repeat command. None means
   // that all the trace has been consumed.
-  llvm::Optional<lldb::user_id_t> m_last_id;
+  std::optional<lldb::user_id_t> m_last_id;
 };
 
 // CommandObjectTraceDumpInfo

diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 43838a178b80d..8a8a01c70ce66 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1301,7 +1301,7 @@ static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id,
 
 void Debugger::ReportProgress(uint64_t progress_id, const std::string &message,
                               uint64_t completed, uint64_t total,
-                              llvm::Optional<lldb::user_id_t> debugger_id) {
+                              std::optional<lldb::user_id_t> debugger_id) {
   // Check if this progress is for a specific debugger.
   if (debugger_id) {
     // It is debugger specific, grab it and deliver the event if the debugger
@@ -1357,7 +1357,7 @@ static void PrivateReportDiagnostic(Debugger &debugger,
 
 void Debugger::ReportDiagnosticImpl(DiagnosticEventData::Type type,
                                     std::string message,
-                                    llvm::Optional<lldb::user_id_t> debugger_id,
+                                    std::optional<lldb::user_id_t> debugger_id,
                                     std::once_flag *once) {
   auto ReportDiagnosticLambda = [&]() {
     // The diagnostic subsystem is optional but we still want to broadcast
@@ -1394,21 +1394,21 @@ void Debugger::ReportDiagnosticImpl(DiagnosticEventData::Type type,
 }
 
 void Debugger::ReportWarning(std::string message,
-                             llvm::Optional<lldb::user_id_t> debugger_id,
+                             std::optional<lldb::user_id_t> debugger_id,
                              std::once_flag *once) {
   ReportDiagnosticImpl(DiagnosticEventData::Type::Warning, std::move(message),
                        debugger_id, once);
 }
 
 void Debugger::ReportError(std::string message,
-                           llvm::Optional<lldb::user_id_t> debugger_id,
+                           std::optional<lldb::user_id_t> debugger_id,
                            std::once_flag *once) {
   ReportDiagnosticImpl(DiagnosticEventData::Type::Error, std::move(message),
                        debugger_id, once);
 }
 
 void Debugger::ReportInfo(std::string message,
-                          llvm::Optional<lldb::user_id_t> debugger_id,
+                          std::optional<lldb::user_id_t> debugger_id,
                           std::once_flag *once) {
   ReportDiagnosticImpl(DiagnosticEventData::Type::Info, std::move(message),
                        debugger_id, once);
@@ -1494,7 +1494,7 @@ bool Debugger::EnableLog(llvm::StringRef channel,
 
 ScriptInterpreter *
 Debugger::GetScriptInterpreter(bool can_create,
-                               llvm::Optional<lldb::ScriptLanguage> language) {
+                               std::optional<lldb::ScriptLanguage> language) {
   std::lock_guard<std::recursive_mutex> locker(m_script_interpreter_mutex);
   lldb::ScriptLanguage script_language =
       language ? *language : GetScriptLanguage();

diff  --git a/lldb/source/Core/DumpDataExtractor.cpp b/lldb/source/Core/DumpDataExtractor.cpp
index 70f34b971518c..17025ef8aa170 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -51,9 +51,9 @@ using namespace lldb;
 
 #define NON_PRINTABLE_CHAR '.'
 
-static llvm::Optional<llvm::APInt> GetAPInt(const DataExtractor &data,
-                                            lldb::offset_t *offset_ptr,
-                                            lldb::offset_t byte_size) {
+static std::optional<llvm::APInt> GetAPInt(const DataExtractor &data,
+                                           lldb::offset_t *offset_ptr,
+                                           lldb::offset_t byte_size) {
   if (byte_size == 0)
     return std::nullopt;
 
@@ -99,7 +99,7 @@ static llvm::Optional<llvm::APInt> GetAPInt(const DataExtractor &data,
 static lldb::offset_t DumpAPInt(Stream *s, const DataExtractor &data,
                                 lldb::offset_t offset, lldb::offset_t byte_size,
                                 bool is_signed, unsigned radix) {
-  llvm::Optional<llvm::APInt> apint = GetAPInt(data, &offset, byte_size);
+  std::optional<llvm::APInt> apint = GetAPInt(data, &offset, byte_size);
   if (apint) {
     std::string apint_str = toString(*apint, radix, is_signed);
     switch (radix) {
@@ -239,7 +239,7 @@ void DumpFloatingPoint(std::ostringstream &ss, FloatT f) {
   ss << f;
 }
 
-static llvm::Optional<MemoryTagMap>
+static std::optional<MemoryTagMap>
 GetMemoryTags(lldb::addr_t addr, size_t length,
               ExecutionContextScope *exe_scope) {
   assert(addr != LLDB_INVALID_ADDRESS);
@@ -295,11 +295,10 @@ GetMemoryTags(lldb::addr_t addr, size_t length,
   return memory_tag_map;
 }
 
-static void
-printMemoryTags(const DataExtractor &DE, Stream *s, lldb::addr_t addr,
-                size_t len,
-                const llvm::Optional<MemoryTagMap> &memory_tag_map) {
-  std::vector<llvm::Optional<lldb::addr_t>> tags =
+static void printMemoryTags(const DataExtractor &DE, Stream *s,
+                            lldb::addr_t addr, size_t len,
+                            const std::optional<MemoryTagMap> &memory_tag_map) {
+  std::vector<std::optional<lldb::addr_t>> tags =
       memory_tag_map->GetTags(addr, len);
 
   // Only print if there is at least one tag for this line
@@ -359,7 +358,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
 
   offset_t offset = start_offset;
 
-  llvm::Optional<MemoryTagMap> memory_tag_map;
+  std::optional<MemoryTagMap> memory_tag_map;
   if (show_memory_tags && base_addr != LLDB_INVALID_ADDRESS)
     memory_tag_map =
         GetMemoryTags(base_addr, DE.GetByteSize() - offset, exe_scope);
@@ -652,7 +651,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
       if (exe_scope)
         target_sp = exe_scope->CalculateTarget();
 
-      llvm::Optional<unsigned> format_max_padding;
+      std::optional<unsigned> format_max_padding;
       if (target_sp)
         format_max_padding = target_sp->GetMaxZeroPaddingInFloatFormat();
 
@@ -667,7 +666,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
       // x87DoubleExtended semantics which has a byte size of 10 (80-bit).
       const size_t semantics_byte_size =
           (llvm::APFloat::getSizeInBits(semantics) + 7) / 8;
-      llvm::Optional<llvm::APInt> apint =
+      std::optional<llvm::APInt> apint =
           GetAPInt(DE, &offset, semantics_byte_size);
       if (apint) {
         llvm::APFloat apfloat(semantics, *apint);

diff  --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp
index 7e9c76e177496..ca830ccc04bc1 100644
--- a/lldb/source/Core/EmulateInstruction.cpp
+++ b/lldb/source/Core/EmulateInstruction.cpp
@@ -73,7 +73,7 @@ EmulateInstruction::FindPlugin(const ArchSpec &arch,
 
 EmulateInstruction::EmulateInstruction(const ArchSpec &arch) : m_arch(arch) {}
 
-llvm::Optional<RegisterValue>
+std::optional<RegisterValue>
 EmulateInstruction::ReadRegister(const RegisterInfo &reg_info) {
   if (m_read_reg_callback == nullptr)
     return {};
@@ -88,11 +88,11 @@ EmulateInstruction::ReadRegister(const RegisterInfo &reg_info) {
 bool EmulateInstruction::ReadRegister(lldb::RegisterKind reg_kind,
                                       uint32_t reg_num,
                                       RegisterValue &reg_value) {
-  llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
+  std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
   if (!reg_info)
     return false;
 
-  llvm::Optional<RegisterValue> value = ReadRegister(*reg_info);
+  std::optional<RegisterValue> value = ReadRegister(*reg_info);
   if (value)
     reg_value = *value;
   return value.has_value();
@@ -113,7 +113,7 @@ uint64_t EmulateInstruction::ReadRegisterUnsigned(lldb::RegisterKind reg_kind,
 uint64_t EmulateInstruction::ReadRegisterUnsigned(const RegisterInfo &reg_info,
                                                   uint64_t fail_value,
                                                   bool *success_ptr) {
-  llvm::Optional<RegisterValue> reg_value = ReadRegister(reg_info);
+  std::optional<RegisterValue> reg_value = ReadRegister(reg_info);
   if (!reg_value) {
     if (success_ptr)
       *success_ptr = false;
@@ -135,7 +135,7 @@ bool EmulateInstruction::WriteRegister(const Context &context,
                                        lldb::RegisterKind reg_kind,
                                        uint32_t reg_num,
                                        const RegisterValue &reg_value) {
-  llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
+  std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
   if (reg_info)
     return WriteRegister(context, *reg_info, reg_value);
   return false;
@@ -145,7 +145,7 @@ bool EmulateInstruction::WriteRegisterUnsigned(const Context &context,
                                                lldb::RegisterKind reg_kind,
                                                uint32_t reg_num,
                                                uint64_t uint_value) {
-  llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
+  std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
   if (reg_info) {
     RegisterValue reg_value;
     if (reg_value.SetUInt(uint_value, reg_info->byte_size))

diff  --git a/lldb/source/Core/Highlighter.cpp b/lldb/source/Core/Highlighter.cpp
index 464b5a4f08696..f49b778baba8c 100644
--- a/lldb/source/Core/Highlighter.cpp
+++ b/lldb/source/Core/Highlighter.cpp
@@ -28,7 +28,7 @@ void HighlightStyle::ColorStyle::Set(llvm::StringRef prefix,
 
 void DefaultHighlighter::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 {
   // If we don't have a valid cursor, then we just print the line as-is.
@@ -73,7 +73,7 @@ HighlighterManager::getHighlighterFor(lldb::LanguageType language_type,
 
 std::string Highlighter::Highlight(const HighlightStyle &options,
                                    llvm::StringRef line,
-                                   llvm::Optional<size_t> cursor_pos,
+                                   std::optional<size_t> cursor_pos,
                                    llvm::StringRef previous_lines) const {
   StreamString s;
   Highlight(options, line, cursor_pos, previous_lines, s);

diff  --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 5f17607ab0565..443ca86fe8f87 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -199,7 +199,7 @@ void IOHandlerConfirm::IOHandlerInputComplete(IOHandler &io_handler,
   }
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 IOHandlerDelegate::IOHandlerSuggestion(IOHandler &io_handler,
                                        llvm::StringRef line) {
   return io_handler.GetDebugger()
@@ -327,7 +327,7 @@ void IOHandlerEditline::TerminalSizeChanged() {
 }
 
 // Split out a line from the buffer, if there is a full one to get.
-static Optional<std::string> SplitLine(std::string &line_buffer) {
+static std::optional<std::string> SplitLine(std::string &line_buffer) {
   size_t pos = line_buffer.find('\n');
   if (pos == std::string::npos)
     return std::nullopt;
@@ -339,7 +339,7 @@ static Optional<std::string> SplitLine(std::string &line_buffer) {
 
 // If the final line of the file ends without a end-of-line, return
 // it as a line anyway.
-static Optional<std::string> SplitLineEOF(std::string &line_buffer) {
+static std::optional<std::string> SplitLineEOF(std::string &line_buffer) {
   if (llvm::all_of(line_buffer, llvm::isSpace))
     return std::nullopt;
   std::string line = std::move(line_buffer);
@@ -373,7 +373,7 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
     }
   }
 
-  Optional<std::string> got_line = SplitLine(m_line_buffer);
+  std::optional<std::string> got_line = SplitLine(m_line_buffer);
 
   if (!got_line && !m_input_sp) {
     // No more input file, we are done...
@@ -447,7 +447,7 @@ int IOHandlerEditline::FixIndentationCallback(Editline *editline,
   return m_delegate.IOHandlerFixIndentation(*this, lines, cursor_position);
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 IOHandlerEditline::SuggestionCallback(llvm::StringRef line) {
   return m_delegate.IOHandlerSuggestion(*this, line);
 }

diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index e242d748b8095..18d8affd58d8c 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -7025,7 +7025,7 @@ class SourceFileWindowDelegate : public WindowDelegate {
 
           StreamString lineStream;
 
-          llvm::Optional<size_t> column;
+          std::optional<size_t> column;
           if (is_pc_line && m_sc.line_entry.IsValid() && m_sc.line_entry.column)
             column = m_sc.line_entry.column - 1;
           m_file_sp->DisplaySourceLines(curr_line + 1, column, 0, 0,

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index f32b2bd97aa5f..2f111be08d099 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1126,7 +1126,7 @@ bool Module::FileHasChanged() const {
 }
 
 void Module::ReportWarningOptimization(
-    llvm::Optional<lldb::user_id_t> debugger_id) {
+    std::optional<lldb::user_id_t> debugger_id) {
   ConstString file_name = GetFileSpec().GetFilename();
   if (file_name.IsEmpty())
     return;
@@ -1140,7 +1140,7 @@ void Module::ReportWarningOptimization(
 }
 
 void Module::ReportWarningUnsupportedLanguage(
-    LanguageType language, llvm::Optional<lldb::user_id_t> debugger_id) {
+    LanguageType language, std::optional<lldb::user_id_t> debugger_id) {
   StreamString ss;
   ss << "This version of LLDB has no plugin for the language \""
      << Language::GetNameForLanguageType(language)
@@ -1635,8 +1635,7 @@ bool Module::FindSourceFile(const FileSpec &orig_spec,
   return false;
 }
 
-llvm::Optional<std::string>
-Module::RemapSourceFile(llvm::StringRef path) const {
+std::optional<std::string> Module::RemapSourceFile(llvm::StringRef path) const {
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
   if (auto remapped = m_source_mappings.RemapPath(path))
     return remapped->GetPath();

diff  --git a/lldb/source/Core/SourceLocationSpec.cpp b/lldb/source/Core/SourceLocationSpec.cpp
index d04047987b6cd..805291f7d59ae 100644
--- a/lldb/source/Core/SourceLocationSpec.cpp
+++ b/lldb/source/Core/SourceLocationSpec.cpp
@@ -14,7 +14,7 @@ using namespace lldb;
 using namespace lldb_private;
 
 SourceLocationSpec::SourceLocationSpec(FileSpec file_spec, uint32_t line,
-                                       llvm::Optional<uint16_t> column,
+                                       std::optional<uint16_t> column,
                                        bool check_inlines, bool exact_match)
     : m_declaration(file_spec, line,
                     column.value_or(LLDB_INVALID_COLUMN_NUMBER)),
@@ -67,14 +67,14 @@ std::string SourceLocationSpec::GetString() const {
   return ss.GetString().str();
 }
 
-llvm::Optional<uint32_t> SourceLocationSpec::GetLine() const {
+std::optional<uint32_t> SourceLocationSpec::GetLine() const {
   uint32_t line = m_declaration.GetLine();
   if (line == 0 || line == LLDB_INVALID_LINE_NUMBER)
     return std::nullopt;
   return line;
 }
 
-llvm::Optional<uint16_t> SourceLocationSpec::GetColumn() const {
+std::optional<uint16_t> SourceLocationSpec::GetColumn() const {
   uint16_t column = m_declaration.GetColumn();
   if (column == LLDB_INVALID_COLUMN_NUMBER)
     return std::nullopt;

diff  --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index 0a54676a22b62..72fabb42507c7 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -223,7 +223,7 @@ size_t SourceManager::DisplaySourceLinesWithLineNumbersUsingLastFile(
       // So far we treated column 0 as a special 'no column value', but
       // DisplaySourceLines starts counting columns from 0 (and no column is
       // expressed by passing an empty optional).
-      llvm::Optional<size_t> columnToHighlight;
+      std::optional<size_t> columnToHighlight;
       if (line == curr_line && column)
         columnToHighlight = column - 1;
 
@@ -558,7 +558,7 @@ void SourceManager::File::UpdateIfNeeded() {
 }
 
 size_t SourceManager::File::DisplaySourceLines(uint32_t line,
-                                               llvm::Optional<size_t> column,
+                                               std::optional<size_t> column,
                                                uint32_t context_before,
                                                uint32_t context_after,
                                                Stream *s) {

diff  --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index fc2a9f1ef5d3b..ccd36096b5456 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -207,7 +207,7 @@ uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
   case ContextType::Variable: // Variable *
   {
     auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
-    if (llvm::Optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
+    if (std::optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
       if (error_ptr)
         error_ptr->Clear();
       return *size;
@@ -305,7 +305,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
   AddressType address_type = eAddressTypeFile;
   Address file_so_addr;
   const CompilerType &ast_type = GetCompilerType();
-  llvm::Optional<uint64_t> type_size = ast_type.GetByteSize(
+  std::optional<uint64_t> type_size = ast_type.GetByteSize(
       exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
   // Nothing to be done for a zero-sized type.
   if (type_size && *type_size == 0)

diff  --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 1ea181372cba4..38645b087435d 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -264,7 +264,7 @@ CompilerType ValueObject::MaybeCalculateCompleteType() {
 
   if (auto *runtime =
           process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
-    if (llvm::Optional<CompilerType> complete_type =
+    if (std::optional<CompilerType> complete_type =
             runtime->GetRuntimeType(compiler_type)) {
       m_override_type = *complete_type;
       if (m_override_type.IsValid())
@@ -683,7 +683,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx,
 
   ExecutionContext exe_ctx(GetExecutionContextRef());
 
-  llvm::Optional<uint64_t> item_type_size =
+  std::optional<uint64_t> item_type_size =
       pointee_or_element_compiler_type.GetByteSize(
           exe_ctx.GetBestExecutionContextScope());
   if (!item_type_size)
@@ -1706,7 +1706,7 @@ ValueObjectSP ValueObject::GetSyntheticChildAtOffset(
     return {};
 
   ExecutionContext exe_ctx(GetExecutionContextRef());
-  llvm::Optional<uint64_t> size =
+  std::optional<uint64_t> size =
       type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
   if (!size)
     return {};
@@ -1748,7 +1748,7 @@ ValueObjectSP ValueObject::GetSyntheticBase(uint32_t offset,
   const bool is_base_class = true;
 
   ExecutionContext exe_ctx(GetExecutionContextRef());
-  llvm::Optional<uint64_t> size =
+  std::optional<uint64_t> size =
       type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
   if (!size)
     return {};

diff  --git a/lldb/source/Core/ValueObjectCast.cpp b/lldb/source/Core/ValueObjectCast.cpp
index 174c390c80dfe..0882d4b367761 100644
--- a/lldb/source/Core/ValueObjectCast.cpp
+++ b/lldb/source/Core/ValueObjectCast.cpp
@@ -48,7 +48,7 @@ size_t ValueObjectCast::CalculateNumChildren(uint32_t max) {
   return children_count <= max ? children_count : max;
 }
 
-llvm::Optional<uint64_t> ValueObjectCast::GetByteSize() {
+std::optional<uint64_t> ValueObjectCast::GetByteSize() {
   ExecutionContext exe_ctx(GetExecutionContextRef());
   return m_value.GetValueByteSize(nullptr, &exe_ctx);
 }

diff  --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp
index 942ceb21d4439..640abdddfcad5 100644
--- a/lldb/source/Core/ValueObjectConstResult.cpp
+++ b/lldb/source/Core/ValueObjectConstResult.cpp
@@ -204,7 +204,7 @@ lldb::ValueType ValueObjectConstResult::GetValueType() const {
   return eValueTypeConstResult;
 }
 
-llvm::Optional<uint64_t> ValueObjectConstResult::GetByteSize() {
+std::optional<uint64_t> ValueObjectConstResult::GetByteSize() {
   ExecutionContext exe_ctx(GetExecutionContextRef());
   if (!m_byte_size) {
     if (auto size =

diff  --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index 965c533636936..0659c771918a5 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -95,7 +95,7 @@ size_t ValueObjectDynamicValue::CalculateNumChildren(uint32_t max) {
     return m_parent->GetNumChildren(max);
 }
 
-llvm::Optional<uint64_t> ValueObjectDynamicValue::GetByteSize() {
+std::optional<uint64_t> ValueObjectDynamicValue::GetByteSize() {
   const bool success = UpdateValueIfNeeded(false);
   if (success && m_dynamic_type_info.HasType()) {
     ExecutionContext exe_ctx(GetExecutionContextRef());

diff  --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp
index 47c9aed7a25d4..3f125a7bee8c7 100644
--- a/lldb/source/Core/ValueObjectMemory.cpp
+++ b/lldb/source/Core/ValueObjectMemory.cpp
@@ -139,7 +139,7 @@ size_t ValueObjectMemory::CalculateNumChildren(uint32_t max) {
   return child_count <= max ? child_count : max;
 }
 
-llvm::Optional<uint64_t> ValueObjectMemory::GetByteSize() {
+std::optional<uint64_t> ValueObjectMemory::GetByteSize() {
   ExecutionContext exe_ctx(GetExecutionContextRef());
   if (m_type_sp)
     return m_type_sp->GetByteSize(exe_ctx.GetBestExecutionContextScope());

diff  --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index 590acc31e346e..a0fbf9a7d25b4 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -83,7 +83,7 @@ size_t ValueObjectRegisterSet::CalculateNumChildren(uint32_t max) {
   return 0;
 }
 
-llvm::Optional<uint64_t> ValueObjectRegisterSet::GetByteSize() { return 0; }
+std::optional<uint64_t> ValueObjectRegisterSet::GetByteSize() { return 0; }
 
 bool ValueObjectRegisterSet::UpdateValue() {
   m_error.Clear();
@@ -229,7 +229,7 @@ size_t ValueObjectRegister::CalculateNumChildren(uint32_t max) {
   return children_count <= max ? children_count : max;
 }
 
-llvm::Optional<uint64_t> ValueObjectRegister::GetByteSize() {
+std::optional<uint64_t> ValueObjectRegister::GetByteSize() {
   return m_reg_info.byte_size;
 }
 

diff  --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index 9bcf18f561180..bd83d59089928 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -122,7 +122,7 @@ bool ValueObjectSynthetic::MightHaveChildren() {
   return (m_might_have_children != eLazyBoolNo);
 }
 
-llvm::Optional<uint64_t> ValueObjectSynthetic::GetByteSize() {
+std::optional<uint64_t> ValueObjectSynthetic::GetByteSize() {
   return m_parent->GetByteSize();
 }
 

diff  --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index ce8d0815765f2..9f8df847f28a8 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -106,7 +106,7 @@ size_t ValueObjectVariable::CalculateNumChildren(uint32_t max) {
   return child_count <= max ? child_count : max;
 }
 
-llvm::Optional<uint64_t> ValueObjectVariable::GetByteSize() {
+std::optional<uint64_t> ValueObjectVariable::GetByteSize() {
   ExecutionContext exe_ctx(GetExecutionContextRef());
 
   CompilerType type(GetCompilerType());

diff  --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
index 46749270732bd..5ee89fc0d5eb3 100644
--- a/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -96,7 +96,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
 
         ExecutionContextScope *exe_scope =
             exe_ctx.GetBestExecutionContextScope();
-        llvm::Optional<uint64_t> size = compiler_type.GetByteSize(exe_scope);
+        std::optional<uint64_t> size = compiler_type.GetByteSize(exe_scope);
         if (!size)
           return false;
         StreamString sstr;

diff  --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp
index d53f865ebab46..4afcfa2e8e490 100644
--- a/lldb/source/DataFormatters/VectorType.cpp
+++ b/lldb/source/DataFormatters/VectorType.cpp
@@ -174,9 +174,9 @@ static size_t CalculateNumChildren(
     lldb_private::ExecutionContextScope *exe_scope =
         nullptr // does not matter here because all we trade in are basic types
     ) {
-  llvm::Optional<uint64_t> container_size =
+  std::optional<uint64_t> container_size =
       container_type.GetByteSize(exe_scope);
-  llvm::Optional<uint64_t> element_size = element_type.GetByteSize(exe_scope);
+  std::optional<uint64_t> element_size = element_type.GetByteSize(exe_scope);
 
   if (container_size && element_size && *element_size) {
     if (*container_size % *element_size)
@@ -201,7 +201,7 @@ class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
   lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
     if (idx >= CalculateNumChildren())
       return {};
-    llvm::Optional<uint64_t> size = m_child_type.GetByteSize(nullptr);
+    std::optional<uint64_t> size = m_child_type.GetByteSize(nullptr);
     if (!size)
       return {};
     auto offset = idx * *size;

diff  --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 0837714667c8d..682ead966e8d2 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -803,11 +803,11 @@ void UpdateValueTypeFromLocationDescription(Log *log, const DWARFUnit *dwarf_cu,
 ///          the load address succeed or an empty Optinal otherwise. If
 ///          check_sectionoffset is true we consider LLDB_INVALID_ADDRESS a
 ///          success if so_addr.IsSectionOffset() is true.
-static llvm::Optional<lldb::addr_t>
+static std::optional<lldb::addr_t>
 ResolveLoadAddress(ExecutionContext *exe_ctx, lldb::ModuleSP &module_sp,
-                          Status *error_ptr, const char *dw_op_type,
-                          lldb::addr_t file_addr, Address &so_addr,
-                          bool check_sectionoffset = false) {
+                   Status *error_ptr, const char *dw_op_type,
+                   lldb::addr_t file_addr, Address &so_addr,
+                   bool check_sectionoffset = false) {
   if (!module_sp) {
     if (error_ptr)
       error_ptr->SetErrorStringWithFormat(

diff  --git a/lldb/source/Expression/ExpressionVariable.cpp b/lldb/source/Expression/ExpressionVariable.cpp
index ed91be4e30165..a397a34601d0c 100644
--- a/lldb/source/Expression/ExpressionVariable.cpp
+++ b/lldb/source/Expression/ExpressionVariable.cpp
@@ -18,7 +18,7 @@ using namespace lldb_private;
 ExpressionVariable::~ExpressionVariable() = default;
 
 uint8_t *ExpressionVariable::GetValueBytes() {
-  llvm::Optional<uint64_t> byte_size = m_frozen_sp->GetByteSize();
+  std::optional<uint64_t> byte_size = m_frozen_sp->GetByteSize();
   if (byte_size && *byte_size) {
     if (m_frozen_sp->GetDataExtractor().GetByteSize() < *byte_size) {
       m_frozen_sp->GetValue().ResizeData(*byte_size);

diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index f374476d83372..c8068eca5c1b5 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -703,7 +703,7 @@ class LoadAddressResolver {
   LoadAddressResolver(Target *target, bool &symbol_was_missing_weak)
       : m_target(target), m_symbol_was_missing_weak(symbol_was_missing_weak) {}
 
-  llvm::Optional<lldb::addr_t> Resolve(SymbolContextList &sc_list) {
+  std::optional<lldb::addr_t> Resolve(SymbolContextList &sc_list) {
     if (sc_list.IsEmpty())
       return std::nullopt;
 

diff  --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp
index 13296cd8ffcee..0932dc6f95b1f 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -544,7 +544,7 @@ class EntityVariableBase : public Materializer::Entity {
           return;
         }
 
-        llvm::Optional<size_t> opt_bit_align = GetTypeBitAlign(scope);
+        std::optional<size_t> opt_bit_align = GetTypeBitAlign(scope);
         if (!opt_bit_align) {
           err.SetErrorStringWithFormat("can't get the type alignment for %s",
                                        GetName().AsCString());
@@ -775,7 +775,7 @@ class EntityVariableBase : public Materializer::Entity {
   ///
   /// \returns On success, returns byte size of the type associated
   ///          with this variable. Returns std::nullopt otherwise.
-  virtual llvm::Optional<uint64_t>
+  virtual std::optional<uint64_t>
   GetByteSize(ExecutionContextScope *scope) const = 0;
 
   /// Returns 'true' if the location expression associated with this variable
@@ -786,7 +786,7 @@ class EntityVariableBase : public Materializer::Entity {
   ///
   /// \returns On success, returns alignment in bits for the type associated
   ///          with this variable. Returns std::nullopt otherwise.
-  virtual llvm::Optional<size_t>
+  virtual std::optional<size_t>
   GetTypeBitAlign(ExecutionContextScope *scope) const = 0;
 
 protected:
@@ -816,7 +816,7 @@ class EntityVariable : public EntityVariableBase {
     return ValueObjectVariable::Create(scope, m_variable_sp);
   }
 
-  llvm::Optional<uint64_t>
+  std::optional<uint64_t>
   GetByteSize(ExecutionContextScope *scope) const override {
     return m_variable_sp->GetType()->GetByteSize(scope);
   }
@@ -825,7 +825,7 @@ class EntityVariable : public EntityVariableBase {
     return m_variable_sp->LocationExpressionList().IsValid();
   }
 
-  llvm::Optional<size_t>
+  std::optional<size_t>
   GetTypeBitAlign(ExecutionContextScope *scope) const override {
     return m_variable_sp->GetType()->GetLayoutCompilerType().GetTypeBitAlign(
         scope);
@@ -859,7 +859,7 @@ class EntityValueObject : public EntityVariableBase {
     return m_valobj_sp;
   }
 
-  llvm::Optional<uint64_t>
+  std::optional<uint64_t>
   GetByteSize(ExecutionContextScope *scope) const override {
     if (m_valobj_sp)
       return m_valobj_sp->GetCompilerType().GetByteSize(scope);
@@ -874,7 +874,7 @@ class EntityValueObject : public EntityVariableBase {
     return false;
   }
 
-  llvm::Optional<size_t>
+  std::optional<size_t>
   GetTypeBitAlign(ExecutionContextScope *scope) const override {
     if (m_valobj_sp)
       return m_valobj_sp->GetCompilerType().GetTypeBitAlign(scope);
@@ -935,14 +935,14 @@ class EntityResultVariable : public Materializer::Entity {
       if (!exe_scope)
         exe_scope = map.GetBestExecutionContextScope();
 
-      llvm::Optional<uint64_t> byte_size = m_type.GetByteSize(exe_scope);
+      std::optional<uint64_t> byte_size = m_type.GetByteSize(exe_scope);
       if (!byte_size) {
         err.SetErrorStringWithFormat("can't get size of type \"%s\"",
                                      m_type.GetTypeName().AsCString());
         return;
       }
 
-      llvm::Optional<size_t> opt_bit_align = m_type.GetTypeBitAlign(exe_scope);
+      std::optional<size_t> opt_bit_align = m_type.GetTypeBitAlign(exe_scope);
       if (!opt_bit_align) {
         err.SetErrorStringWithFormat("can't get the alignment of type  \"%s\"",
                                      m_type.GetTypeName().AsCString());

diff  --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index 2670d9f869aec..544804db3879e 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -1063,7 +1063,7 @@ unsigned char Editline::ApplyAutosuggestCommand(int ch) {
   llvm::StringRef line(line_info->buffer,
                        line_info->lastchar - line_info->buffer);
 
-  if (llvm::Optional<std::string> to_add = m_suggestion_callback(line))
+  if (std::optional<std::string> to_add = m_suggestion_callback(line))
     el_insertstr(m_editline, to_add->c_str());
 
   return CC_REDISPLAY;
@@ -1086,7 +1086,7 @@ unsigned char Editline::TypedCharacter(int ch) {
   const char *ansi_suffix =
       m_color_prompts ? m_suggestion_ansi_suffix.c_str() : "";
 
-  if (llvm::Optional<std::string> to_add = m_suggestion_callback(line)) {
+  if (std::optional<std::string> to_add = m_suggestion_callback(line)) {
     std::string to_add_color = ansi_prefix + to_add.value() + ansi_suffix;
     fputs(typed.c_str(), m_output_file);
     fputs(to_add_color.c_str(), m_output_file);

diff  --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index f242c9fd8d6a2..15e7a211e353e 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -778,7 +778,7 @@ SerialPort::OptionsFromURL(llvm::StringRef urlqs) {
       serial_options.BaudRate = baud_rate;
     } else if (x.consume_front("parity=")) {
       serial_options.Parity =
-          llvm::StringSwitch<llvm::Optional<Terminal::Parity>>(x)
+          llvm::StringSwitch<std::optional<Terminal::Parity>>(x)
               .Case("no", Terminal::Parity::No)
               .Case("even", Terminal::Parity::Even)
               .Case("odd", Terminal::Parity::Odd)
@@ -792,7 +792,7 @@ SerialPort::OptionsFromURL(llvm::StringRef urlqs) {
             x.str().c_str());
     } else if (x.consume_front("parity-check=")) {
       serial_options.ParityCheck =
-          llvm::StringSwitch<llvm::Optional<Terminal::ParityCheck>>(x)
+          llvm::StringSwitch<std::optional<Terminal::ParityCheck>>(x)
               .Case("no", Terminal::ParityCheck::No)
               .Case("replace", Terminal::ParityCheck::ReplaceWithNUL)
               .Case("ignore", Terminal::ParityCheck::Ignore)

diff  --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index 5143a175056a2..96ff1bf13bd7d 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -61,8 +61,8 @@ void FileSystem::Terminate() {
   InstanceImpl().reset();
 }
 
-Optional<FileSystem> &FileSystem::InstanceImpl() {
-  static Optional<FileSystem> g_fs;
+std::optional<FileSystem> &FileSystem::InstanceImpl() {
+  static std::optional<FileSystem> g_fs;
   return g_fs;
 }
 

diff  --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index 4fcfacc689a02..d5e5628e55592 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -108,9 +108,9 @@ const ArchSpec &HostInfoBase::GetArchitecture(ArchitectureKind arch_kind) {
                                               : g_fields->m_host_arch_32;
 }
 
-llvm::Optional<HostInfoBase::ArchitectureKind>
+std::optional<HostInfoBase::ArchitectureKind>
 HostInfoBase::ParseArchitectureKind(llvm::StringRef kind) {
-  return llvm::StringSwitch<llvm::Optional<ArchitectureKind>>(kind)
+  return llvm::StringSwitch<std::optional<ArchitectureKind>>(kind)
       .Case(LLDB_ARCH_DEFAULT, eArchKindDefault)
       .Case(LLDB_ARCH_DEFAULT_32BIT, eArchKind32)
       .Case(LLDB_ARCH_DEFAULT_64BIT, eArchKind64)

diff  --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp
index 124c98cd9365f..ac18cc9b09d9f 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -67,7 +67,7 @@ NativeProcessProtocol::WriteMemoryTags(int32_t type, lldb::addr_t addr,
   return Status("not implemented");
 }
 
-llvm::Optional<WaitStatus> NativeProcessProtocol::GetExitStatus() {
+std::optional<WaitStatus> NativeProcessProtocol::GetExitStatus() {
   if (m_state == lldb::eStateExited)
     return m_exit_status;
 
@@ -128,7 +128,7 @@ NativeProcessProtocol::GetWatchpointMap() const {
   return m_watchpoint_list.GetWatchpointMap();
 }
 
-llvm::Optional<std::pair<uint32_t, uint32_t>>
+std::optional<std::pair<uint32_t, uint32_t>>
 NativeProcessProtocol::GetHardwareDebugSupportInfo() const {
   Log *log = GetLog(LLDBLog::Process);
 

diff  --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp
index e9b8627317b6f..436dfd8130d9b 100644
--- a/lldb/source/Host/common/Terminal.cpp
+++ b/lldb/source/Host/common/Terminal.cpp
@@ -126,7 +126,7 @@ llvm::Error Terminal::SetRaw() {
 }
 
 #if LLDB_ENABLE_TERMIOS
-static llvm::Optional<speed_t> baudRateToConst(unsigned int baud_rate) {
+static std::optional<speed_t> baudRateToConst(unsigned int baud_rate) {
   switch (baud_rate) {
 #if defined(B50)
   case 50:
@@ -277,7 +277,7 @@ llvm::Error Terminal::SetBaudRate(unsigned int baud_rate) {
     return data.takeError();
 
   struct termios &fd_termios = data->m_termios;
-  llvm::Optional<speed_t> val = baudRateToConst(baud_rate);
+  std::optional<speed_t> val = baudRateToConst(baud_rate);
   if (!val) // invalid value
     return llvm::createStringError(llvm::inconvertibleErrorCode(),
                                    "baud rate %d unsupported by the platform",

diff  --git a/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
index 75ca3c1358b81..9832a3f078497 100644
--- a/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
+++ b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
@@ -31,7 +31,7 @@ llvm::VersionTuple HostInfoFreeBSD::GetOSVersion() {
   return llvm::VersionTuple();
 }
 
-llvm::Optional<std::string> HostInfoFreeBSD::GetOSBuildString() {
+std::optional<std::string> HostInfoFreeBSD::GetOSBuildString() {
   int mib[2] = {CTL_KERN, KERN_OSREV};
   uint32_t osrev = 0;
   size_t osrev_len = sizeof(osrev);

diff  --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index c467fcfd423d9..6c57384aa38a1 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -318,7 +318,7 @@ Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
   return Status("unimplemented");
 }
 
-llvm::Optional<lldb::pid_t> lldb_private::getPIDForTID(lldb::pid_t tid) {
+std::optional<lldb::pid_t> lldb_private::getPIDForTID(lldb::pid_t tid) {
   ::pid_t tracerpid, tgid = LLDB_INVALID_PROCESS_ID;
   ProcessInstanceInfo process_info;
   ProcessState state;

diff  --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 1cf7b9c50f92c..018be54ecf7aa 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -67,7 +67,7 @@ llvm::VersionTuple HostInfoLinux::GetOSVersion() {
   return g_fields->m_os_version;
 }
 
-llvm::Optional<std::string> HostInfoLinux::GetOSBuildString() {
+std::optional<std::string> HostInfoLinux::GetOSBuildString() {
   struct utsname un;
   ::memset(&un, 0, sizeof(utsname));
 

diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index f8a8072909ae8..5a39ed370747a 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -62,7 +62,7 @@
 
 using namespace lldb_private;
 
-llvm::Optional<std::string> HostInfoMacOSX::GetOSBuildString() {
+std::optional<std::string> HostInfoMacOSX::GetOSBuildString() {
   int mib[2] = {CTL_KERN, KERN_OSVERSION};
   char cstr[PATH_MAX];
   size_t cstr_len = sizeof(cstr);

diff  --git a/lldb/source/Host/netbsd/HostInfoNetBSD.cpp b/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
index 6e98bde65d065..0de4f2530bbaa 100644
--- a/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
@@ -43,7 +43,7 @@ llvm::VersionTuple HostInfoNetBSD::GetOSVersion() {
   return llvm::VersionTuple();
 }
 
-llvm::Optional<std::string> HostInfoNetBSD::GetOSBuildString() {
+std::optional<std::string> HostInfoNetBSD::GetOSBuildString() {
   int mib[2] = {CTL_KERN, KERN_OSREV};
   char osrev_str[12];
   int osrev = 0;

diff  --git a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
index 0c283e41146d2..43f22be51ef95 100644
--- a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
+++ b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
@@ -30,7 +30,7 @@ llvm::VersionTuple HostInfoOpenBSD::GetOSVersion() {
   return llvm::VersionTuple();
 }
 
-llvm::Optional<std::string> HostInfoOpenBSD::GetOSBuildString() {
+std::optional<std::string> HostInfoOpenBSD::GetOSBuildString() {
   int mib[2] = {CTL_KERN, KERN_OSREV};
   char osrev_str[12];
   uint32_t osrev = 0;

diff  --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp
index c6ef7ad34f599..731a7dee2e620 100644
--- a/lldb/source/Host/posix/HostInfoPosix.cpp
+++ b/lldb/source/Host/posix/HostInfoPosix.cpp
@@ -39,7 +39,7 @@ bool HostInfoPosix::GetHostname(std::string &s) {
   return false;
 }
 
-llvm::Optional<std::string> HostInfoPosix::GetOSKernelDescription() {
+std::optional<std::string> HostInfoPosix::GetOSKernelDescription() {
   struct utsname un;
   if (uname(&un) < 0)
     return std::nullopt;
@@ -57,8 +57,8 @@ llvm::Optional<std::string> HostInfoPosix::GetOSKernelDescription() {
 namespace {
 class PosixUserIDResolver : public UserIDResolver {
 protected:
-  llvm::Optional<std::string> DoGetUserName(id_t uid) override;
-  llvm::Optional<std::string> DoGetGroupName(id_t gid) override;
+  std::optional<std::string> DoGetUserName(id_t uid) override;
+  std::optional<std::string> DoGetGroupName(id_t gid) override;
 };
 } // namespace
 
@@ -67,7 +67,7 @@ struct PasswdEntry {
   std::string shell;
 };
 
-static llvm::Optional<PasswdEntry> GetPassword(id_t uid) {
+static std::optional<PasswdEntry> GetPassword(id_t uid) {
 #ifdef USE_GETPWUID
   // getpwuid_r is missing from android-9
   // The caller should provide some thread safety by making sure no one calls
@@ -89,13 +89,13 @@ static llvm::Optional<PasswdEntry> GetPassword(id_t uid) {
   return std::nullopt;
 }
 
-llvm::Optional<std::string> PosixUserIDResolver::DoGetUserName(id_t uid) {
-  if (llvm::Optional<PasswdEntry> password = GetPassword(uid))
+std::optional<std::string> PosixUserIDResolver::DoGetUserName(id_t uid) {
+  if (std::optional<PasswdEntry> password = GetPassword(uid))
     return password->username;
   return std::nullopt;
 }
 
-llvm::Optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) {
+std::optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) {
 #ifndef __ANDROID__
   char group_buffer[PATH_MAX];
   size_t group_buffer_size = sizeof(group_buffer);
@@ -134,7 +134,7 @@ uint32_t HostInfoPosix::GetEffectiveGroupID() { return getegid(); }
 FileSpec HostInfoPosix::GetDefaultShell() {
   if (const char *v = ::getenv("SHELL"))
     return FileSpec(v);
-  if (llvm::Optional<PasswdEntry> password = GetPassword(::geteuid()))
+  if (std::optional<PasswdEntry> password = GetPassword(::geteuid()))
     return FileSpec(password->shell);
   return FileSpec("/bin/sh");
 }

diff  --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp
index 6ccd5d206156d..bdb234c07859f 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -29,10 +29,10 @@ using namespace lldb_private;
 namespace {
 class WindowsUserIDResolver : public UserIDResolver {
 protected:
-  llvm::Optional<std::string> DoGetUserName(id_t uid) override {
+  std::optional<std::string> DoGetUserName(id_t uid) override {
     return std::nullopt;
   }
-  llvm::Optional<std::string> DoGetGroupName(id_t gid) override {
+  std::optional<std::string> DoGetGroupName(id_t gid) override {
     return std::nullopt;
   }
 };
@@ -75,7 +75,7 @@ llvm::VersionTuple HostInfoWindows::GetOSVersion() {
                             info.wServicePackMajor);
 }
 
-llvm::Optional<std::string> HostInfoWindows::GetOSBuildString() {
+std::optional<std::string> HostInfoWindows::GetOSBuildString() {
   llvm::VersionTuple version = GetOSVersion();
   if (version.empty())
     return std::nullopt;
@@ -83,7 +83,7 @@ llvm::Optional<std::string> HostInfoWindows::GetOSBuildString() {
   return "Windows NT " + version.getAsString();
 }
 
-llvm::Optional<std::string> HostInfoWindows::GetOSKernelDescription() {
+std::optional<std::string> HostInfoWindows::GetOSKernelDescription() {
   return GetOSBuildString();
 }
 

diff  --git a/lldb/source/Interpreter/CommandHistory.cpp b/lldb/source/Interpreter/CommandHistory.cpp
index ae07b54bbc2bb..f5dbcb675030f 100644
--- a/lldb/source/Interpreter/CommandHistory.cpp
+++ b/lldb/source/Interpreter/CommandHistory.cpp
@@ -24,7 +24,7 @@ bool CommandHistory::IsEmpty() const {
   return m_history.empty();
 }
 
-llvm::Optional<llvm::StringRef>
+std::optional<llvm::StringRef>
 CommandHistory::FindString(llvm::StringRef input_str) const {
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
   if (input_str.size() < 2)

diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 47a6f09cd40b5..8b24c72d77337 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2007,7 +2007,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
     // repeat command, even though we don't add repeat commands to the history.
     if (add_to_history || empty_command) {
       Args command_args(command_string);
-      llvm::Optional<std::string> repeat_command =
+      std::optional<std::string> repeat_command =
           cmd_obj->GetRepeatCommand(command_args, 0);
       if (repeat_command)
         m_repeat_command.assign(*repeat_command);
@@ -2111,7 +2111,7 @@ void CommandInterpreter::HandleCompletion(CompletionRequest &request) {
   HandleCompletionMatches(request);
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 CommandInterpreter::GetAutoSuggestionForCommand(llvm::StringRef line) {
   if (line.empty())
     return std::nullopt;

diff  --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index 92e62b05fb78d..46ba995244678 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -88,7 +88,7 @@ ScriptInterpreter::GetStatusFromSBError(const lldb::SBError &error) const {
   return Status();
 }
 
-llvm::Optional<MemoryRegionInfo>
+std::optional<MemoryRegionInfo>
 ScriptInterpreter::GetOpaqueTypeFromSBMemoryRegionInfo(
     const lldb::SBMemoryRegionInfo &mem_region) const {
   if (!mem_region.m_opaque_up)

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
index bb33286657014..ef53309f065fd 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
@@ -76,11 +76,11 @@ uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) {
 
 static void addPartialRegisters(
     std::vector<lldb_private::DynamicRegisterInfo::Register> &regs,
-    llvm::ArrayRef<llvm::Optional<uint32_t>> full_reg_indices,
+    llvm::ArrayRef<std::optional<uint32_t>> full_reg_indices,
     uint32_t full_reg_size, const char *partial_reg_format,
     uint32_t partial_reg_size, lldb::Encoding encoding, lldb::Format format) {
   for (auto it : llvm::enumerate(full_reg_indices)) {
-    llvm::Optional<uint32_t> full_reg_index = it.value();
+    std::optional<uint32_t> full_reg_index = it.value();
     if (!full_reg_index || regs[*full_reg_index].byte_size != full_reg_size)
       return;
 
@@ -109,8 +109,8 @@ void ABIAArch64::AugmentRegisterInfo(
 
   lldb_private::ConstString sp_string{"sp"};
 
-  std::array<llvm::Optional<uint32_t>, 32> x_regs;
-  std::array<llvm::Optional<uint32_t>, 32> v_regs;
+  std::array<std::optional<uint32_t>, 32> x_regs;
+  std::array<std::optional<uint32_t>, 32> v_regs;
 
   for (auto it : llvm::enumerate(regs)) {
     lldb_private::DynamicRegisterInfo::Register &info = it.value();

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index 26a798d2a52bd..cce7c81bb06c3 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -142,7 +142,7 @@ bool ABIMacOSX_arm64::GetArgumentValues(Thread &thread,
       return false;
 
     CompilerType value_type = value->GetCompilerType();
-    llvm::Optional<uint64_t> bit_size = value_type.GetBitSize(&thread);
+    std::optional<uint64_t> bit_size = value_type.GetBitSize(&thread);
     if (!bit_size)
       return false;
 
@@ -495,7 +495,7 @@ static bool LoadValueFromConsecutiveGPRRegisters(
     uint32_t &NGRN,       // NGRN (see ABI documentation)
     uint32_t &NSRN,       // NSRN (see ABI documentation)
     DataExtractor &data) {
-  llvm::Optional<uint64_t> byte_size =
+  std::optional<uint64_t> byte_size =
       value_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
   if (!byte_size || *byte_size == 0)
     return false;
@@ -513,7 +513,7 @@ static bool LoadValueFromConsecutiveGPRRegisters(
     if (NSRN < 8 && (8 - NSRN) >= homogeneous_count) {
       if (!base_type)
         return false;
-      llvm::Optional<uint64_t> base_byte_size =
+      std::optional<uint64_t> base_byte_size =
           base_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
       if (!base_byte_size)
         return false;
@@ -648,8 +648,7 @@ ValueObjectSP ABIMacOSX_arm64::GetReturnValueObjectImpl(
   if (!reg_ctx)
     return return_valobj_sp;
 
-  llvm::Optional<uint64_t> byte_size =
-      return_compiler_type.GetByteSize(&thread);
+  std::optional<uint64_t> byte_size = return_compiler_type.GetByteSize(&thread);
   if (!byte_size)
     return return_valobj_sp;
 

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
index 5cb348ba82129..d46545a93583e 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
@@ -147,7 +147,7 @@ bool ABISysV_arm64::GetArgumentValues(Thread &thread, ValueList &values) const {
     if (value_type) {
       bool is_signed = false;
       size_t bit_width = 0;
-      llvm::Optional<uint64_t> bit_size = value_type.GetBitSize(&thread);
+      std::optional<uint64_t> bit_size = value_type.GetBitSize(&thread);
       if (!bit_size)
         return false;
       if (value_type.IsIntegerOrEnumerationType(is_signed)) {
@@ -469,7 +469,7 @@ static bool LoadValueFromConsecutiveGPRRegisters(
     uint32_t &NGRN,       // NGRN (see ABI documentation)
     uint32_t &NSRN,       // NSRN (see ABI documentation)
     DataExtractor &data) {
-  llvm::Optional<uint64_t> byte_size =
+  std::optional<uint64_t> byte_size =
       value_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
 
   if (byte_size || *byte_size == 0)
@@ -488,7 +488,7 @@ static bool LoadValueFromConsecutiveGPRRegisters(
     if (NSRN < 8 && (8 - NSRN) >= homogeneous_count) {
       if (!base_type)
         return false;
-      llvm::Optional<uint64_t> base_byte_size =
+      std::optional<uint64_t> base_byte_size =
           base_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
       if (!base_byte_size)
         return false;
@@ -618,8 +618,7 @@ ValueObjectSP ABISysV_arm64::GetReturnValueObjectImpl(
   if (!reg_ctx)
     return return_valobj_sp;
 
-  llvm::Optional<uint64_t> byte_size =
-      return_compiler_type.GetByteSize(&thread);
+  std::optional<uint64_t> byte_size = return_compiler_type.GetByteSize(&thread);
   if (!byte_size)
     return return_valobj_sp;
 

diff  --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
index e73e08f230e2d..d5358c1a6ad1d 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
@@ -98,7 +98,7 @@ class ABISysV_arc : public lldb_private::RegInfoBasedABI {
 
   using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
 
-  using RegisterFileFlag = llvm::Optional<bool>;
+  using RegisterFileFlag = std::optional<bool>;
   mutable RegisterFileFlag m_is_reg_file_reduced;
 };
 

diff  --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
index 0367b4ff61ae0..3b6c0955371ec 100644
--- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
@@ -1349,7 +1349,7 @@ bool ABIMacOSX_arm::GetArgumentValues(Thread &thread, ValueList &values) const {
     if (compiler_type) {
       bool is_signed = false;
       size_t bit_width = 0;
-      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;
       if (compiler_type.IsIntegerOrEnumerationType(is_signed))
@@ -1455,7 +1455,7 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl(
 
   const RegisterInfo *r0_reg_info = reg_ctx->GetRegisterInfoByName("r0", 0);
   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;
 
@@ -1475,7 +1475,7 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl(
           const RegisterInfo *r3_reg_info =
               reg_ctx->GetRegisterInfoByName("r3", 0);
           if (r1_reg_info && r2_reg_info && r3_reg_info) {
-            llvm::Optional<uint64_t> byte_size =
+            std::optional<uint64_t> byte_size =
                 compiler_type.GetByteSize(&thread);
             if (!byte_size)
               return return_valobj_sp;

diff  --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
index 0afad7669cc83..218af1dca2c0d 100644
--- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
@@ -1354,7 +1354,7 @@ bool ABISysV_arm::GetArgumentValues(Thread &thread, ValueList &values) const {
       size_t bit_width = 0;
       if (compiler_type.IsIntegerOrEnumerationType(is_signed) ||
           compiler_type.IsPointerOrReferenceType()) {
-        if (llvm::Optional<uint64_t> size = compiler_type.GetBitSize(&thread))
+        if (std::optional<uint64_t> size = compiler_type.GetBitSize(&thread))
           bit_width = *size;
       } else {
         // We only handle integer, pointer and reference types currently...
@@ -1461,8 +1461,8 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
 
   const RegisterInfo *r0_reg_info =
       reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1);
-  llvm::Optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread);
-  llvm::Optional<uint64_t> byte_size = compiler_type.GetByteSize(&thread);
+  std::optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread);
+  std::optional<uint64_t> byte_size = compiler_type.GetByteSize(&thread);
   if (!bit_width || !byte_size)
     return return_valobj_sp;
 
@@ -1598,8 +1598,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
           compiler_type.IsHomogeneousAggregate(&base_type);
 
       if (homogeneous_count > 0 && homogeneous_count <= 4) {
-        llvm::Optional<uint64_t> base_byte_size =
-            base_type.GetByteSize(&thread);
+        std::optional<uint64_t> base_byte_size = base_type.GetByteSize(&thread);
         if (base_type.IsVectorType()) {
           if (base_byte_size &&
               (*base_byte_size == 8 || *base_byte_size == 16)) {
@@ -1627,7 +1626,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
                                                       nullptr, nullptr);
 
             if (base_type.IsFloatingPointType(float_count, is_complex)) {
-              llvm::Optional<uint64_t> base_byte_size =
+              std::optional<uint64_t> base_byte_size =
                   base_type.GetByteSize(&thread);
               if (float_count == 2 && is_complex) {
                 if (index != 0 && base_byte_size &&

diff  --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
index 508c7a7982703..a94be159cbbd2 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
@@ -768,7 +768,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
 
   // In MIPS register "r2" (v0) holds the integer function return values
   const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0);
-  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.IsIntegerOrEnumerationType(is_signed)) {

diff  --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
index c61e5fabf1f04..97b8e61a9b925 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
@@ -715,8 +715,7 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl(
   Target *target = exe_ctx.GetTargetPtr();
   const ArchSpec target_arch = target->GetArchitecture();
   ByteOrder target_byte_order = target_arch.GetByteOrder();
-  llvm::Optional<uint64_t> byte_size =
-      return_compiler_type.GetByteSize(&thread);
+  std::optional<uint64_t> byte_size = return_compiler_type.GetByteSize(&thread);
   if (!byte_size)
     return return_valobj_sp;
   const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
@@ -925,7 +924,7 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl(
             CompilerType field_compiler_type =
                 return_compiler_type.GetFieldAtIndex(
                     idx, name, &field_bit_offset, nullptr, nullptr);
-            llvm::Optional<uint64_t> field_byte_width =
+            std::optional<uint64_t> field_byte_width =
                 field_compiler_type.GetByteSize(&thread);
             if (!field_byte_width)
               return return_valobj_sp;
@@ -997,7 +996,7 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl(
 
         CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
             idx, name, &field_bit_offset, nullptr, nullptr);
-        llvm::Optional<uint64_t> field_byte_width =
+        std::optional<uint64_t> field_byte_width =
             field_compiler_type.GetByteSize(&thread);
 
         // if we don't know the size of the field (e.g. invalid type), just

diff  --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
index 6f7d9facccb78..8879b57bed0c6 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
@@ -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;
@@ -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");
@@ -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;
@@ -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);
@@ -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);
@@ -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()) {
@@ -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;

diff  --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
index 1090e96cdda79..bb4b4e0377740 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
@@ -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;
@@ -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");
@@ -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) {
@@ -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 {};

diff  --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
index 521f8b97b2b7f..4436bcd37503b 100644
--- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
+++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
@@ -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;
@@ -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");
@@ -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;
@@ -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);

diff  --git a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
index 1df898c2c5732..4d2e16da4cda7 100644
--- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
@@ -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))
@@ -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 =

diff  --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
index 85ee0b8f9254a..2bc6e3b891e6f 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
@@ -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)) {
@@ -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;
@@ -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);

diff  --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
index df93d456f1691..9d5ed1fa2666d 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
@@ -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;
@@ -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");
@@ -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;
@@ -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 =
@@ -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 =
@@ -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) {
@@ -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()) {

diff  --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
index 3b7280993b2c6..6d9b3ae3c6363 100644
--- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
@@ -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;
@@ -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");
@@ -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;
@@ -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 =
@@ -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 =
@@ -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) {
@@ -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;
   }

diff  --git a/lldb/source/Plugins/ABI/X86/ABIX86.cpp b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
index 13ea522e220c7..3c55a6ea17e8f 100644
--- a/lldb/source/Plugins/ABI/X86/ABIX86.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
@@ -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

diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index b79e1e551d45d..6ae5f2ad9a2cf 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -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;
@@ -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

diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
index 17e6b67373530..6104e40277db9 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
@@ -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,

diff  --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 34148bdc5775a..13a6ffa78a6e1 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -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;
 }
@@ -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;

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
index ac4168089a02a..95e8a600f8382 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
@@ -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);
   }

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
index 3bc6820befc7e..c084c3fbefc5d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
@@ -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

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index a72a12b9d94dc..58e81fb1cd745 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -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;
@@ -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;

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
index 65ec51b67f218..89d9ac042e57a 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
@@ -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};

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
index a955431681600..219ed641615eb 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
@@ -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);

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
index 6b529f01204ff..e42ae89bb4c84 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
@@ -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());

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
index d383edd1af8de..0f564751b8779 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
@@ -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,

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
index 38e8993137866..f05624c6119bf 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -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;

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
index 0086817226554..055ad0711f90c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
@@ -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;
@@ -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)))

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
index 4508bf1f14dc6..3eda04dc022a7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
@@ -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.
@@ -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 {};
 

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.h b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.h
index e96bf3715ace6..24289c83e88e8 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.h
@@ -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;
@@ -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.

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 49a6b4521e77f..ec0243d92099b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -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);
@@ -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;

diff  --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
index 141641b0d50d7..5ab256a62e078 100644
--- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -43,7 +43,7 @@ LLDB_PLUGIN_DEFINE_ADV(EmulateInstructionARM, InstructionARM)
 // ITSession implementation
 //
 
-static llvm::Optional<RegisterInfo> GetARMDWARFRegisterInfo(unsigned reg_num) {
+static std::optional<RegisterInfo> GetARMDWARFRegisterInfo(unsigned reg_num) {
   RegisterInfo reg_info;
   ::memset(&reg_info, 0, sizeof(RegisterInfo));
   ::memset(reg_info.kinds, LLDB_INVALID_REGNUM, sizeof(reg_info.kinds));
@@ -784,7 +784,7 @@ bool EmulateInstructionARM::WriteBits32Unknown(int n) {
   return true;
 }
 
-llvm::Optional<RegisterInfo>
+std::optional<RegisterInfo>
 EmulateInstructionARM::GetRegisterInfo(lldb::RegisterKind reg_kind,
                                        uint32_t reg_num) {
   if (reg_kind == eRegisterKindGeneric) {
@@ -971,11 +971,11 @@ bool EmulateInstructionARM::EmulatePUSH(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextPushRegisterOnStack;
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
     for (i = 0; i < 15; ++i) {
       if (BitIsSet(registers, i)) {
-        llvm::Optional<RegisterInfo> reg_info =
+        std::optional<RegisterInfo> reg_info =
             GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
         context.SetRegisterToRegisterPlusOffset(*reg_info, *sp_reg, addr - sp);
         uint32_t reg_value = ReadCoreReg(i, &success);
@@ -988,7 +988,7 @@ bool EmulateInstructionARM::EmulatePUSH(const uint32_t opcode,
     }
 
     if (BitIsSet(registers, 15)) {
-      llvm::Optional<RegisterInfo> reg_info =
+      std::optional<RegisterInfo> reg_info =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
       context.SetRegisterToRegisterPlusOffset(*reg_info, *sp_reg, addr - sp);
       const uint32_t pc = ReadCoreReg(PC_REG, &success);
@@ -1100,7 +1100,7 @@ bool EmulateInstructionARM::EmulatePOP(const uint32_t opcode,
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextPopRegisterOffStack;
 
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
 
     for (i = 0; i < 15; ++i) {
@@ -1187,7 +1187,7 @@ bool EmulateInstructionARM::EmulateADDRdSPImm(const uint32_t opcode,
       context.type = eContextSetFramePointer;
     else
       context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
     context.SetRegisterPlusOffset(*sp_reg, sp_offset);
 
@@ -1243,7 +1243,7 @@ bool EmulateInstructionARM::EmulateMOVRdSP(const uint32_t opcode,
       context.type = EmulateInstruction::eContextSetFramePointer;
     else
       context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
     context.SetRegisterPlusOffset(*sp_reg, 0);
 
@@ -1340,7 +1340,7 @@ bool EmulateInstructionARM::EmulateMOVRdRm(const uint32_t opcode,
       context.type = EmulateInstruction::eContextSetFramePointer;
     else
       context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
     context.SetRegisterPlusOffset(*dwarf_reg, 0);
 
@@ -1559,9 +1559,9 @@ bool EmulateInstructionARM::EmulateMUL(const uint32_t opcode,
     uint64_t result = operand1 * operand2;
 
     // R[d] = result<31:0>;
-    llvm::Optional<RegisterInfo> op1_reg =
+    std::optional<RegisterInfo> op1_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> op2_reg =
+    std::optional<RegisterInfo> op2_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -1767,7 +1767,7 @@ bool EmulateInstructionARM::EmulateLDRRtPCRelative(const uint32_t opcode,
     // PC relative immediate load context
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> pc_reg =
+    std::optional<RegisterInfo> pc_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
     context.SetRegisterPlusOffset(*pc_reg, 0);
 
@@ -1911,7 +1911,7 @@ bool EmulateInstructionARM::EmulateADDSPImm(const uint32_t opcode,
     else
       context.type = EmulateInstruction::eContextRegisterPlusOffset;
 
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
     context.SetRegisterPlusOffset(*sp_reg, res.result - sp);
 
@@ -1978,9 +1978,9 @@ bool EmulateInstructionARM::EmulateADDSPRm(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = eContextArithmetic;
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
-    llvm::Optional<RegisterInfo> other_reg =
+    std::optional<RegisterInfo> other_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
     context.SetRegisterRegisterOperands(*sp_reg, *other_reg);
 
@@ -2150,7 +2150,7 @@ bool EmulateInstructionARM::EmulateBLXRm(const uint32_t opcode,
     addr_t target = ReadCoreReg(Rm, &success);
     if (!success)
       return false;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
     context.SetRegister(*dwarf_reg);
     if (!WriteRegisterUnsigned(context, eRegisterKindGeneric,
@@ -2196,7 +2196,7 @@ bool EmulateInstructionARM::EmulateBXRm(const uint32_t opcode,
     if (!success)
       return false;
 
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
     context.SetRegister(*dwarf_reg);
     if (!BXWritePC(context, target))
@@ -2254,7 +2254,7 @@ bool EmulateInstructionARM::EmulateBXJRm(const uint32_t opcode,
     if (!success)
       return false;
 
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
     context.SetRegister(*dwarf_reg);
     if (!BXWritePC(context, target))
@@ -2303,7 +2303,7 @@ bool EmulateInstructionARM::EmulateSUBR7IPImm(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r12);
     context.SetRegisterPlusOffset(*dwarf_reg, -ip_offset);
 
@@ -2353,7 +2353,7 @@ bool EmulateInstructionARM::EmulateSUBIPSPImm(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
     context.SetRegisterPlusOffset(*dwarf_reg, -sp_offset);
 
@@ -2515,9 +2515,9 @@ bool EmulateInstructionARM::EmulateSTRRtSP(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextPushRegisterOnStack;
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rt);
 
     context.SetRegisterToRegisterPlusOffset(*dwarf_reg, *sp_reg, addr - sp);
@@ -2614,10 +2614,10 @@ bool EmulateInstructionARM::EmulateVPUSH(const uint32_t opcode,
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextPushRegisterOnStack;
 
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
     for (i = 0; i < regs; ++i) {
-      llvm::Optional<RegisterInfo> dwarf_reg =
+      std::optional<RegisterInfo> dwarf_reg =
           GetRegisterInfo(eRegisterKindDWARF, start_reg + d + i);
       context.SetRegisterToRegisterPlusOffset(*dwarf_reg, *sp_reg, addr - sp);
       // uint64_t to accommodate 64-bit registers.
@@ -2708,7 +2708,7 @@ bool EmulateInstructionARM::EmulateVPOP(const uint32_t opcode,
     context.type = EmulateInstruction::eContextPopRegisterOffStack;
 
     for (i = 0; i < regs; ++i) {
-      llvm::Optional<RegisterInfo> dwarf_reg =
+      std::optional<RegisterInfo> dwarf_reg =
           GetRegisterInfo(eRegisterKindDWARF, start_reg + d + i);
       context.SetAddress(addr);
       data = MemARead(context, addr, reg_byte_size, 0, &success);
@@ -3106,7 +3106,7 @@ bool EmulateInstructionARM::EmulateADDImmThumb(const uint32_t opcode,
     //(result, carry, overflow) = AddWithCarry(R[n], imm32, '0');
     AddWithCarryResult res = AddWithCarry(Rn, imm32, 0);
 
-    llvm::Optional<RegisterInfo> reg_n =
+    std::optional<RegisterInfo> reg_n =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     EmulateInstruction::Context context;
     context.type = eContextArithmetic;
@@ -3179,7 +3179,7 @@ bool EmulateInstructionARM::EmulateADDImmARM(const uint32_t opcode,
     else
       context.type = EmulateInstruction::eContextRegisterPlusOffset;
 
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, Rn);
     context.SetRegisterPlusOffset(*dwarf_reg, imm32);
 
@@ -3267,9 +3267,9 @@ bool EmulateInstructionARM::EmulateADDReg(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = eContextArithmetic;
-    llvm::Optional<RegisterInfo> op1_reg =
+    std::optional<RegisterInfo> op1_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rn);
-    llvm::Optional<RegisterInfo> op2_reg =
+    std::optional<RegisterInfo> op2_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
     context.SetRegisterRegisterOperands(*op1_reg, *op2_reg);
 
@@ -3978,7 +3978,7 @@ bool EmulateInstructionARM::EmulateLDM(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     context.SetRegisterPlusOffset(*dwarf_reg, offset);
 
@@ -4098,7 +4098,7 @@ bool EmulateInstructionARM::EmulateLDMDA(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     context.SetRegisterPlusOffset(*dwarf_reg, offset);
 
@@ -4234,7 +4234,7 @@ bool EmulateInstructionARM::EmulateLDMDB(const uint32_t opcode,
     addr_t address = Rn - (addr_byte_size * BitCount(registers));
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     context.SetRegisterPlusOffset(*dwarf_reg, Rn - address);
 
@@ -4345,7 +4345,7 @@ bool EmulateInstructionARM::EmulateLDMIB(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterPlusOffset;
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     context.SetRegisterPlusOffset(*dwarf_reg, offset);
 
@@ -4515,7 +4515,7 @@ bool EmulateInstructionARM::EmulateLDRRtRnImm(const uint32_t opcode,
 
     address = (index ? offset_addr : base);
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rn);
     if (wback) {
       EmulateInstruction::Context ctx;
@@ -4651,7 +4651,7 @@ bool EmulateInstructionARM::EmulateSTM(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterStore;
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     // for i = 0 to 14
@@ -4673,7 +4673,7 @@ bool EmulateInstructionARM::EmulateSTM(const uint32_t opcode,
           if (!success)
             return false;
 
-          llvm::Optional<RegisterInfo> data_reg =
+          std::optional<RegisterInfo> data_reg =
               GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
           context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, offset);
           if (!MemAWrite(context, address + offset, data, addr_byte_size))
@@ -4688,7 +4688,7 @@ bool EmulateInstructionARM::EmulateSTM(const uint32_t opcode,
     // if registers<15> == '1' then // Only possible for encoding A1
     //     MemA[address,4] = PCStoreValue();
     if (BitIsSet(registers, 15)) {
-      llvm::Optional<RegisterInfo> pc_reg =
+      std::optional<RegisterInfo> pc_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
       context.SetRegisterPlusOffset(*pc_reg, 8);
       const uint32_t pc = ReadCoreReg(PC_REG, &success);
@@ -4773,7 +4773,7 @@ bool EmulateInstructionARM::EmulateSTMDA(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterStore;
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     // for i = 0 to 14
@@ -4794,7 +4794,7 @@ bool EmulateInstructionARM::EmulateSTMDA(const uint32_t opcode,
           if (!success)
             return false;
 
-          llvm::Optional<RegisterInfo> data_reg =
+          std::optional<RegisterInfo> data_reg =
               GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
           context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
                                                   Rn - (address + offset));
@@ -4810,7 +4810,7 @@ bool EmulateInstructionARM::EmulateSTMDA(const uint32_t opcode,
     // if registers<15> == '1' then
     //    MemA[address,4] = PCStoreValue();
     if (BitIsSet(registers, 15)) {
-      llvm::Optional<RegisterInfo> pc_reg =
+      std::optional<RegisterInfo> pc_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
       context.SetRegisterPlusOffset(*pc_reg, 8);
       const uint32_t pc = ReadCoreReg(PC_REG, &success);
@@ -4921,7 +4921,7 @@ bool EmulateInstructionARM::EmulateSTMDB(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterStore;
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     // for i = 0 to 14
@@ -4943,7 +4943,7 @@ bool EmulateInstructionARM::EmulateSTMDB(const uint32_t opcode,
           if (!success)
             return false;
 
-          llvm::Optional<RegisterInfo> data_reg =
+          std::optional<RegisterInfo> data_reg =
               GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
           context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
                                                   Rn - (address + offset));
@@ -4959,7 +4959,7 @@ bool EmulateInstructionARM::EmulateSTMDB(const uint32_t opcode,
     // if registers<15> == '1' then // Only possible for encoding A1
     //     MemA[address,4] = PCStoreValue();
     if (BitIsSet(registers, 15)) {
-      llvm::Optional<RegisterInfo> pc_reg =
+      std::optional<RegisterInfo> pc_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
       context.SetRegisterPlusOffset(*pc_reg, 8);
       const uint32_t pc = ReadCoreReg(PC_REG, &success);
@@ -5044,7 +5044,7 @@ bool EmulateInstructionARM::EmulateSTMIB(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = EmulateInstruction::eContextRegisterStore;
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t lowest_set_bit = 14;
@@ -5066,7 +5066,7 @@ bool EmulateInstructionARM::EmulateSTMIB(const uint32_t opcode,
           if (!success)
             return false;
 
-          llvm::Optional<RegisterInfo> data_reg =
+          std::optional<RegisterInfo> data_reg =
               GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
           context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
                                                   offset + addr_byte_size);
@@ -5082,7 +5082,7 @@ bool EmulateInstructionARM::EmulateSTMIB(const uint32_t opcode,
     // if registers<15> == '1' then
     // MemA[address,4] = PCStoreValue();
     if (BitIsSet(registers, 15)) {
-      llvm::Optional<RegisterInfo> pc_reg =
+      std::optional<RegisterInfo> pc_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
       context.SetRegisterPlusOffset(*pc_reg, 8);
       const uint32_t pc = ReadCoreReg(PC_REG, &success);
@@ -5235,7 +5235,7 @@ bool EmulateInstructionARM::EmulateSTRThumb(const uint32_t opcode,
     else
       context.type = eContextRegisterStore;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     // if UnalignedSupport() || address<1:0> == '00' then
@@ -5247,7 +5247,7 @@ bool EmulateInstructionARM::EmulateSTRThumb(const uint32_t opcode,
       if (!success)
         return false;
 
-      llvm::Optional<RegisterInfo> data_reg =
+      std::optional<RegisterInfo> data_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
       int32_t offset = address - base_address;
       context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, offset);
@@ -5441,9 +5441,9 @@ bool EmulateInstructionARM::EmulateSTRRegister(const uint32_t opcode,
         CurrentInstrSet() == eModeARM) {
       // MemU[address,4] = data;
 
-      llvm::Optional<RegisterInfo> base_reg =
+      std::optional<RegisterInfo> base_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-      llvm::Optional<RegisterInfo> data_reg =
+      std::optional<RegisterInfo> data_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
 
       context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
@@ -5566,9 +5566,9 @@ bool EmulateInstructionARM::EmulateSTRBThumb(const uint32_t opcode,
       address = base_address;
 
     // MemU[address,1] = R[t]<7:0>
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
 
     EmulateInstruction::Context context;
@@ -5745,11 +5745,11 @@ bool EmulateInstructionARM::EmulateSTRHRegister(const uint32_t opcode,
 
       EmulateInstruction::Context context;
       context.type = eContextRegisterStore;
-      llvm::Optional<RegisterInfo> base_reg =
+      std::optional<RegisterInfo> base_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-      llvm::Optional<RegisterInfo> offset_reg =
+      std::optional<RegisterInfo> offset_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
-      llvm::Optional<RegisterInfo> data_reg =
+      std::optional<RegisterInfo> data_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
       context.SetRegisterToRegisterPlusIndirectOffset(*base_reg, *offset_reg,
                                                       *data_reg);
@@ -6399,7 +6399,7 @@ bool EmulateInstructionARM::EmulateLDRImmediateARM(const uint32_t opcode,
 
     // data = MemU[address,4];
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     EmulateInstruction::Context context;
     context.type = eContextRegisterLoad;
@@ -6604,7 +6604,7 @@ bool EmulateInstructionARM::EmulateLDRRegister(const uint32_t opcode,
       address = Rn;
 
     // data = MemU[address,4];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
     EmulateInstruction::Context context;
     context.type = eContextRegisterLoad;
@@ -6781,9 +6781,9 @@ bool EmulateInstructionARM::EmulateLDRBImmediate(const uint32_t opcode,
       address = Rn;
 
     // R[t] = ZeroExtend(MemU[address,1], 32);
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
 
     EmulateInstruction::Context context;
@@ -7025,7 +7025,7 @@ bool EmulateInstructionARM::EmulateLDRBRegister(const uint32_t opcode,
       address = Rn;
 
     // R[t] = ZeroExtend(MemU[address,1],32);
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     EmulateInstruction::Context context;
@@ -7162,7 +7162,7 @@ bool EmulateInstructionARM::EmulateLDRHImmediate(const uint32_t opcode,
       address = Rn;
 
     // data = MemU[address,2];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     EmulateInstruction::Context context;
@@ -7272,7 +7272,7 @@ bool EmulateInstructionARM::EmulateLDRHLiteral(const uint32_t opcode,
       address = base - imm32;
 
     // data = MemU[address,2];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
 
     EmulateInstruction::Context context;
@@ -7440,9 +7440,9 @@ bool EmulateInstructionARM::EmulateLDRHRegister(const uint32_t opcode,
       address = Rn;
 
     // data = MemU[address,2];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> offset_reg =
+    std::optional<RegisterInfo> offset_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -7599,7 +7599,7 @@ bool EmulateInstructionARM::EmulateLDRSBImmediate(const uint32_t opcode,
       address = Rn;
 
     // R[t] = SignExtend(MemU[address,1], 32);
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     EmulateInstruction::Context context;
@@ -7696,7 +7696,7 @@ bool EmulateInstructionARM::EmulateLDRSBLiteral(const uint32_t opcode,
       address = base - imm32;
 
     // R[t] = SignExtend(MemU[address,1], 32);
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
 
     EmulateInstruction::Context context;
@@ -7845,9 +7845,9 @@ bool EmulateInstructionARM::EmulateLDRSBRegister(const uint32_t opcode,
       address = Rn;
 
     // R[t] = SignExtend(MemU[address,1], 32);
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> offset_reg =
+    std::optional<RegisterInfo> offset_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -7997,7 +7997,7 @@ bool EmulateInstructionARM::EmulateLDRSHImmediate(const uint32_t opcode,
       address = Rn;
 
     // data = MemU[address,2];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     EmulateInstruction::Context context;
@@ -8107,7 +8107,7 @@ bool EmulateInstructionARM::EmulateLDRSHLiteral(const uint32_t opcode,
       address = base - imm32;
 
     // data = MemU[address,2];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
 
     EmulateInstruction::Context context;
@@ -8273,9 +8273,9 @@ bool EmulateInstructionARM::EmulateLDRSHRegister(const uint32_t opcode,
       address = Rn;
 
     // data = MemU[address,2];
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> offset_reg =
+    std::optional<RegisterInfo> offset_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -8385,7 +8385,7 @@ bool EmulateInstructionARM::EmulateSXTB(const uint32_t opcode,
     // R[d] = SignExtend(rotated<7:0>, 32);
     int64_t data = llvm::SignExtend64<8>(rotated);
 
-    llvm::Optional<RegisterInfo> source_reg =
+    std::optional<RegisterInfo> source_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -8468,7 +8468,7 @@ bool EmulateInstructionARM::EmulateSXTH(const uint32_t opcode,
       return false;
 
     // R[d] = SignExtend(rotated<15:0>, 32);
-    llvm::Optional<RegisterInfo> source_reg =
+    std::optional<RegisterInfo> source_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -8553,7 +8553,7 @@ bool EmulateInstructionARM::EmulateUXTB(const uint32_t opcode,
       return false;
 
     // R[d] = ZeroExtend(rotated<7:0>, 32);
-    llvm::Optional<RegisterInfo> source_reg =
+    std::optional<RegisterInfo> source_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -8635,7 +8635,7 @@ bool EmulateInstructionARM::EmulateUXTH(const uint32_t opcode,
       return false;
 
     // R[d] = ZeroExtend(rotated<15:0>, 32);
-    llvm::Optional<RegisterInfo> source_reg =
+    std::optional<RegisterInfo> source_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     EmulateInstruction::Context context;
@@ -8754,7 +8754,7 @@ bool EmulateInstructionARM::EmulateRFE(const uint32_t opcode,
         address = address + 4;
 
       // CPSRWriteByInstr(MemA[address+4,4], '1111', TRUE);
-      llvm::Optional<RegisterInfo> base_reg =
+      std::optional<RegisterInfo> base_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
       EmulateInstruction::Context context;
@@ -9716,7 +9716,7 @@ bool EmulateInstructionARM::EmulateSUBImmARM(const uint32_t opcode,
     else
       context.type = EmulateInstruction::eContextRegisterPlusOffset;
 
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, Rn);
     int64_t imm32_signed = imm32;
     context.SetRegisterPlusOffset(*dwarf_reg, -imm32_signed);
@@ -10069,9 +10069,9 @@ bool EmulateInstructionARM::EmulateSUBSPReg(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = eContextArithmetic;
-    llvm::Optional<RegisterInfo> sp_reg =
+    std::optional<RegisterInfo> sp_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
-    llvm::Optional<RegisterInfo> dwarf_reg =
+    std::optional<RegisterInfo> dwarf_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
     context.SetRegisterRegisterOperands(*sp_reg, *dwarf_reg);
 
@@ -10156,9 +10156,9 @@ bool EmulateInstructionARM::EmulateADDRegShift(const uint32_t opcode,
     // R[d] = result;
     EmulateInstruction::Context context;
     context.type = eContextArithmetic;
-    llvm::Optional<RegisterInfo> reg_n =
+    std::optional<RegisterInfo> reg_n =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> reg_m =
+    std::optional<RegisterInfo> reg_m =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
 
     context.SetRegisterRegisterOperands(*reg_n, *reg_m);
@@ -10296,9 +10296,9 @@ bool EmulateInstructionARM::EmulateSUBReg(const uint32_t opcode,
 
     EmulateInstruction::Context context;
     context.type = eContextArithmetic;
-    llvm::Optional<RegisterInfo> reg_n =
+    std::optional<RegisterInfo> reg_n =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> reg_m =
+    std::optional<RegisterInfo> reg_m =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
     context.SetRegisterRegisterOperands(*reg_n, *reg_m);
 
@@ -10384,9 +10384,9 @@ bool EmulateInstructionARM::EmulateSTREX(const uint32_t opcode,
 
     addr_t address = Rn + imm32;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
     EmulateInstruction::Context context;
     context.type = eContextRegisterStore;
@@ -10495,9 +10495,9 @@ bool EmulateInstructionARM::EmulateSTRBImmARM(const uint32_t opcode,
     if (!success)
       return false;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
     EmulateInstruction::Context context;
     context.type = eContextRegisterStore;
@@ -10583,9 +10583,9 @@ bool EmulateInstructionARM::EmulateSTRImmARM(const uint32_t opcode,
     else
       address = Rn;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
     EmulateInstruction::Context context;
     context.type = eContextRegisterStore;
@@ -10980,7 +10980,7 @@ bool EmulateInstructionARM::EmulateSTRDImm(const uint32_t opcode,
       return false;
     }
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t Rn = ReadCoreReg(n, &success);
@@ -11002,7 +11002,7 @@ bool EmulateInstructionARM::EmulateSTRDImm(const uint32_t opcode,
       address = Rn;
 
     // MemA[address,4] = R[t];
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
 
     uint32_t data = ReadCoreReg(t, &success);
@@ -11144,11 +11144,11 @@ bool EmulateInstructionARM::EmulateSTRDReg(const uint32_t opcode,
     else
       context.type = eContextRegisterStore;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> offset_reg =
+    std::optional<RegisterInfo> offset_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
     context.SetRegisterToRegisterPlusIndirectOffset(*base_reg, *offset_reg,
                                                     *data_reg);
@@ -11321,7 +11321,7 @@ bool EmulateInstructionARM::EmulateVLDM(const uint32_t opcode,
 
     context.type = eContextRegisterLoad;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     // for r = 0 to regs-1
@@ -11483,7 +11483,7 @@ bool EmulateInstructionARM::EmulateVSTM(const uint32_t opcode,
       return false;
     }
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t Rn = ReadCoreReg(n, &success);
@@ -11528,7 +11528,7 @@ bool EmulateInstructionARM::EmulateVSTM(const uint32_t opcode,
         if (!success)
           return false;
 
-        llvm::Optional<RegisterInfo> data_reg =
+        std::optional<RegisterInfo> data_reg =
             GetRegisterInfo(eRegisterKindDWARF, start_reg + d + r);
         context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
                                                 address - Rn);
@@ -11547,7 +11547,7 @@ bool EmulateInstructionARM::EmulateVSTM(const uint32_t opcode,
         if (!success)
           return false;
 
-        llvm::Optional<RegisterInfo> data_reg =
+        std::optional<RegisterInfo> data_reg =
             GetRegisterInfo(eRegisterKindDWARF, start_reg + d + r);
 
         if (GetByteOrder() == eByteOrderBig) {
@@ -11641,7 +11641,7 @@ bool EmulateInstructionARM::EmulateVLDR(const uint32_t opcode,
     default:
       return false;
     }
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t Rn = ReadCoreReg(n, &success);
@@ -11790,9 +11790,9 @@ bool EmulateInstructionARM::EmulateVSTR(const uint32_t opcode,
     const uint32_t addr_byte_size = GetAddressByteSize();
     uint32_t start_reg = single_reg ? dwarf_s0 : dwarf_d0;
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, start_reg + d);
     EmulateInstruction::Context context;
     context.type = eContextRegisterStore;
@@ -11938,7 +11938,7 @@ bool EmulateInstructionARM::EmulateVLD1Multiple(const uint32_t opcode,
       return false;
     }
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t Rn = ReadCoreReg(n, &success);
@@ -12131,7 +12131,7 @@ bool EmulateInstructionARM::EmulateVLD1Single(const uint32_t opcode,
       uint32_t value = Rn + offset;
 
       context.type = eContextAdjustBaseRegister;
-      llvm::Optional<RegisterInfo> base_reg =
+      std::optional<RegisterInfo> base_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
       context.SetRegisterPlusOffset(*base_reg, offset);
 
@@ -12270,7 +12270,7 @@ bool EmulateInstructionARM::EmulateVST1Multiple(const uint32_t opcode,
       return false;
     }
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t Rn = ReadCoreReg(n, &success);
@@ -12307,7 +12307,7 @@ bool EmulateInstructionARM::EmulateVST1Multiple(const uint32_t opcode,
     context.type = eContextRegisterStore;
     // for r = 0 to regs-1
     for (uint32_t r = 0; r < regs; ++r) {
-      llvm::Optional<RegisterInfo> data_reg =
+      std::optional<RegisterInfo> data_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_d0 + d + r);
       uint64_t register_data = ReadRegisterUnsigned(
           eRegisterKindDWARF, dwarf_d0 + d + r, 0, &success);
@@ -12437,7 +12437,7 @@ bool EmulateInstructionARM::EmulateVST1Single(const uint32_t opcode,
       return false;
     }
 
-    llvm::Optional<RegisterInfo> base_reg =
+    std::optional<RegisterInfo> base_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
 
     uint32_t Rn = ReadCoreReg(n, &success);
@@ -12480,7 +12480,7 @@ bool EmulateInstructionARM::EmulateVST1Single(const uint32_t opcode,
     uint64_t word =
         Bits64(register_data, ((index + 1) * esize) - 1, index * esize);
 
-    llvm::Optional<RegisterInfo> data_reg =
+    std::optional<RegisterInfo> data_reg =
         GetRegisterInfo(eRegisterKindDWARF, dwarf_d0 + d);
     context.type = eContextRegisterStore;
     context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
@@ -12586,7 +12586,7 @@ bool EmulateInstructionARM::EmulateVLD1SingleAll(const uint32_t opcode,
         offset = ebytes;
 
       context.type = eContextAdjustBaseRegister;
-      llvm::Optional<RegisterInfo> base_reg =
+      std::optional<RegisterInfo> base_reg =
           GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
       context.SetRegisterPlusOffset(*base_reg, offset);
 

diff  --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
index e3d8b47a42622..7b8849ede9c7d 100644
--- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
+++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
@@ -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;
 

diff  --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
index 39e8c16eb8ee1..0861d24dcc794 100644
--- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
+++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
@@ -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];
@@ -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) {
@@ -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);
@@ -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);
@@ -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;
 
@@ -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;
 
@@ -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;
@@ -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;
 

diff  --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
index e1e0175044d90..b4b107fc267b6 100644
--- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
+++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
@@ -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

diff  --git a/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp b/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
index b405eace3d923..fb0317acc91af 100644
--- a/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
+++ b/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp
@@ -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) {

diff  --git a/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h b/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
index ca60218405e0e..e5193dfad7db0 100644
--- a/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
+++ b/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h
@@ -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; }

diff  --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
index 0bc80635ccb4f..1be41e4a316bf 100644
--- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
+++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
@@ -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) {
@@ -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);
@@ -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;
@@ -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;
@@ -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;
 
@@ -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;
@@ -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);
@@ -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);
@@ -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);
@@ -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;
@@ -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;
 
@@ -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;
@@ -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;
@@ -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;
 
@@ -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;
@@ -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;
@@ -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);

diff  --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h
index 4a3bc59b520e3..ab30be6a8f0d3 100644
--- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h
+++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h
@@ -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

diff  --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
index fe363adb53b71..c472f90ea3ba2 100644
--- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
+++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
@@ -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) {
@@ -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);
@@ -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;
@@ -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;
 
@@ -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;
@@ -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);

diff  --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
index 84c480c55bb4e..e94269e52f837 100644
--- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
+++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
@@ -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

diff  --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
index d64112fccfc14..3035c51341778 100644
--- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
+++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
@@ -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) {
@@ -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;
@@ -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;
 
@@ -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;
 
@@ -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;

diff  --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
index a57b2004c8644..7b63819e51312 100644
--- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
+++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
@@ -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;
 

diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index b1615db207aa7..4fe025ad5d1af 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -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;
 }
@@ -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))
@@ -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));
@@ -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);
 }
@@ -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);
@@ -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) {
@@ -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);
@@ -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) {
@@ -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) {

diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
index f76de56558e4c..c3997b89466b9 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
@@ -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;

diff  --git a/lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h b/lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
index 4bcecf4efd1f5..d9c2ffbe9cbfa 100644
--- a/lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
+++ b/lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
@@ -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)                                                        \

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
index 4c26cb69e9316..a835f8116e0a6 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
@@ -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*[])
@@ -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())
@@ -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();
 
@@ -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.
@@ -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 {
@@ -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();

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
index 63e85a395e5c6..77482f6d8e8fa 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
@@ -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.
@@ -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.
@@ -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();
@@ -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.

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
index 12b6f13081bb3..bbd1e52ebaaf1 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -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;
@@ -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;

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
index 70b50fae48bf2..bc65570fe339c 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
@@ -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 {};
@@ -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 {};

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index f799e374eb1c0..ff3113f0aadb4 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -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));
@@ -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));
@@ -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);
@@ -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)

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
index ab791ee0931d9..fbea4ec017171 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
@@ -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();

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
index 7dc975742dcbc..ec062ed21ee40 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
@@ -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.

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
index 8ad3a62b383aa..e4956b3753639 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
@@ -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;
 
@@ -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));
 

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
index cb3aa64bd69f5..218ff9cd47411 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
@@ -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) {
@@ -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));

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index 1c7245c97be75..90976fa053b8a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -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;

diff  --git a/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp b/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
index ee45f246edd13..6b78ce5de697a 100644
--- a/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
+++ b/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
@@ -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;

diff  --git a/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.h b/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.h
index 99e7b6ade5686..20bb09502d42f 100644
--- a/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.h
+++ b/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.h
@@ -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

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index 19a1eafe17872..4c456dda5fd9e 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -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

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
index 5ce0e02e40811..bc8738094316c 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -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;
 };
 

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
index 710a679e068d3..e28f224101bb8 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
@@ -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;

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index 5e919df98785a..f968a090c0f7b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -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;

diff  --git a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
index d5b07467567f0..4f9661eb0cdf0 100644
--- a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -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);
@@ -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) {
@@ -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;
@@ -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;
 

diff  --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
index de1d45d73970e..f26d6df1e9105 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
@@ -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:
@@ -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;
@@ -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;
@@ -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;
@@ -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);
 }
@@ -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);
@@ -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;
@@ -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)
@@ -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);
@@ -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;
@@ -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 ...
@@ -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);
@@ -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

diff  --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
index ad1060916bfd7..416f84fe2430e 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
@@ -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) {}
@@ -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)) {}
 
@@ -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;
@@ -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) {}
 
@@ -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) {}
 
@@ -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),
@@ -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),
@@ -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),
@@ -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),
@@ -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;
 };
 
@@ -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,

diff  --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
index 89180e8cec804..33673f139b49a 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
@@ -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);
@@ -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;
 
@@ -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));
@@ -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;
@@ -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.

diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 8cc0e8d37e627..0213bcc1708e7 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -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);
@@ -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);
@@ -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());

diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index c97e69eedf58f..bc8e34981a9d8 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -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;
 

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 8fb75220bd3f7..1af005c84e782 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -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;
@@ -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)
@@ -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) {

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index a54e52700b66e..343e3bc004b6f 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -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;

diff  --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 759573946578e..e2007de19c8c7 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -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))

diff  --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
index 4ff16849f1734..3da3a752a1573 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -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;
 
@@ -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;
 };

diff  --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
index 277a0afe551ea..756c7a8ee2cc4 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -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
@@ -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;
 
@@ -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) {
@@ -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());
     }

diff  --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
index 2b8836e871c20..531b5f0437a43 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -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,

diff  --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 2f35a2b57553a..1afce4f41a823 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -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")

diff  --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index d16622af6107a..10ede1c30b244 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -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);
 
@@ -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")
@@ -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());

diff  --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
index 7468a90d7cefe..0281196865de5 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
@@ -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;
 

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
index 53801ed7d0b4e..eed8611bfb85f 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
@@ -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();

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 8e2a96b7973d7..4f49e46ee4426 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -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)) {

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
index 230efe74d07ff..393d99f450487 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -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);
 

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
index 49d8a8eea16e6..d8007b4f4727f 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
@@ -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);
       }
     }

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
index 8360458de08f7..a244ee35976b6 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
@@ -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];

diff  --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
index d980dd670d9a9..05d946fcfc612 100644
--- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
+++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
@@ -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 {
@@ -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 {
@@ -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;
 };

diff  --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 593258112fb03..de7db62c6fd7f 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -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) {

diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 7cbc504e4bb63..ad2bd9894e515 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -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;
 

diff  --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 0d5883049eaa2..0858a2a8d3c8b 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -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;
@@ -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);
 
@@ -284,7 +284,7 @@ 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))
@@ -292,7 +292,7 @@ PlatformRemoteGDBServer::DoGetUserName(UserIDResolver::id_t uid) {
   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))

diff  --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index 2e04a6eb60c05..638f7db5ef800 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -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;
@@ -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;
 

diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp
index b42818ca71221..b8db7f2f3788b 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp
@@ -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()) {
@@ -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.
@@ -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.

diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h
index 7256fbcc33824..0b4a508a7d5dd 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h
@@ -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);

diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp
index 21d20137f4809..7ad9e3c209dff 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp
@@ -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()) {
@@ -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.
@@ -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.

diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h
index b2f15eda96b34..3df371036f915 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h
@@ -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);

diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
index 475433aebe571..f4171a134aeb7 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
@@ -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()) {
@@ -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.
@@ -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);
@@ -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.
@@ -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);
@@ -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)

diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
index 865f93bceb0e7..54ec9fc154ca2 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.h
@@ -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);
@@ -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

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
index 95960a0c303b4..277fec9f7116e 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -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();
@@ -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();

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
index 642ba9399dbd5..376bd5c1fc98c 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
@@ -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)

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
index 78ce9e24aa4ac..4179136cd8ea6 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
@@ -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:

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
index a30d4d67c1e4e..a1636ad8b9f7d 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
@@ -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);

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
index c325849aeeff4..8c76323845f77 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
@@ -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:

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
index 46c7b8314fc0e..6bd15ade9858f 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
@@ -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;
 };
 

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
index 21e088d0bb664..5bce6da4c4a9b 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
@@ -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)

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
index e573e0b116a01..550cd46127ed9 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h
@@ -62,7 +62,7 @@ class IntelPTThreadTraceCollection {
   size_t GetTracedThreadsCount() const;
 
   /// \copydoc IntelPTProcessTrace::TryGetBinaryData()
-  llvm::Expected<llvm::Optional<std::vector<uint8_t>>>
+  llvm::Expected<std::optional<std::vector<uint8_t>>>
   TryGetBinaryData(const TraceGetBinaryDataRequest &request);
 
 private:

diff  --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 40c3e3477f0a7..5fb26ad1f11cc 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1311,7 +1311,7 @@ NativeProcessLinux::Syscall(llvm::ArrayRef<uint64_t> args) {
 llvm::Expected<addr_t>
 NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions) {
 
-  llvm::Optional<NativeRegisterContextLinux::MmapData> mmap_data =
+  std::optional<NativeRegisterContextLinux::MmapData> mmap_data =
       GetCurrentThread()->GetRegisterContext().GetMmapData();
   if (!mmap_data)
     return llvm::make_error<UnimplementedError>();
@@ -1336,7 +1336,7 @@ NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions) {
 }
 
 llvm::Error NativeProcessLinux::DeallocateMemory(lldb::addr_t addr) {
-  llvm::Optional<NativeRegisterContextLinux::MmapData> mmap_data =
+  std::optional<NativeRegisterContextLinux::MmapData> mmap_data =
       GetCurrentThread()->GetRegisterContext().GetMmapData();
   if (!mmap_data)
     return llvm::make_error<UnimplementedError>();
@@ -1870,7 +1870,7 @@ void NativeProcessLinux::ThreadWasCreated(NativeThreadLinux &thread) {
   }
 }
 
-static llvm::Optional<WaitStatus> HandlePid(::pid_t pid) {
+static std::optional<WaitStatus> HandlePid(::pid_t pid) {
   Log *log = GetLog(POSIXLog::Process);
 
   int status;
@@ -1906,13 +1906,13 @@ void NativeProcessLinux::SigchldHandler() {
     if (thread_up->GetID() == GetID())
       checked_main_thread = true;
 
-    if (llvm::Optional<WaitStatus> status = HandlePid(thread_up->GetID()))
+    if (std::optional<WaitStatus> status = HandlePid(thread_up->GetID()))
       tid_events.try_emplace(thread_up->GetID(), *status);
   }
   // Check the main thread even when we're not tracking it as process exit
   // events are reported that way.
   if (!checked_main_thread) {
-    if (llvm::Optional<WaitStatus> status = HandlePid(GetID()))
+    if (std::optional<WaitStatus> status = HandlePid(GetID()))
       tid_events.try_emplace(GetID(), *status);
   }
 

diff  --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
index 9de009fc203d0..08f19d374e280 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
@@ -54,7 +54,7 @@ class NativeRegisterContextLinux
   };
   /// Return architecture-specific data needed to make inferior syscalls, if
   /// they are supported.
-  virtual llvm::Optional<SyscallData> GetSyscallData() { return std::nullopt; }
+  virtual std::optional<SyscallData> GetSyscallData() { return std::nullopt; }
 
   struct MmapData {
     // Syscall numbers can be found (e.g.) in /usr/include/asm/unistd.h for the
@@ -64,7 +64,7 @@ class NativeRegisterContextLinux
   };
   /// Return the architecture-specific data needed to make mmap syscalls, if
   /// they are supported.
-  virtual llvm::Optional<MmapData> GetMmapData() { return std::nullopt; }
+  virtual std::optional<MmapData> GetMmapData() { return std::nullopt; }
 
   struct MemoryTaggingDetails {
     /// Object with tag handling utilities. If the function below returns

diff  --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 6032ca2786119..c57b9499d5247 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -76,12 +76,12 @@ NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
 
     NativeProcessLinux &process = native_thread.GetProcess();
 
-    llvm::Optional<uint64_t> auxv_at_hwcap =
+    std::optional<uint64_t> auxv_at_hwcap =
         process.GetAuxValue(AuxVector::AUXV_AT_HWCAP);
     if (auxv_at_hwcap && (*auxv_at_hwcap & HWCAP_PACA))
       opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskPAuth);
 
-    llvm::Optional<uint64_t> auxv_at_hwcap2 =
+    std::optional<uint64_t> auxv_at_hwcap2 =
         process.GetAuxValue(AuxVector::AUXV_AT_HWCAP2);
     if (auxv_at_hwcap2 && (*auxv_at_hwcap2 & HWCAP2_MTE))
       opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);

diff  --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
index 78715aba5504e..4f1d2fab50f2b 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -1040,7 +1040,7 @@ NativeRegisterContextLinux_x86_64::GetPtraceOffset(uint32_t reg_index) {
          (IsMPX(reg_index) ? 128 : 0);
 }
 
-llvm::Optional<NativeRegisterContextLinux::SyscallData>
+std::optional<NativeRegisterContextLinux::SyscallData>
 NativeRegisterContextLinux_x86_64::GetSyscallData() {
   switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
   case llvm::Triple::x86: {
@@ -1062,7 +1062,7 @@ NativeRegisterContextLinux_x86_64::GetSyscallData() {
   }
 }
 
-llvm::Optional<NativeRegisterContextLinux::MmapData>
+std::optional<NativeRegisterContextLinux::MmapData>
 NativeRegisterContextLinux_x86_64::GetMmapData() {
   switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
   case llvm::Triple::x86:

diff  --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
index 37f1fa4fe2b8a..43d939da84a39 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
@@ -46,9 +46,9 @@ class NativeRegisterContextLinux_x86_64
 
   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 
-  llvm::Optional<SyscallData> GetSyscallData() override;
+  std::optional<SyscallData> GetSyscallData() override;
 
-  llvm::Optional<MmapData> GetMmapData() override;
+  std::optional<MmapData> GetMmapData() override;
 
 protected:
   void *GetGPRBuffer() override { return &m_gpr_x86_64; }

diff  --git a/lldb/source/Plugins/Process/Linux/Procfs.cpp b/lldb/source/Plugins/Process/Linux/Procfs.cpp
index 863c6271eb14d..8186f79806681 100644
--- a/lldb/source/Plugins/Process/Linux/Procfs.cpp
+++ b/lldb/source/Plugins/Process/Linux/Procfs.cpp
@@ -52,7 +52,7 @@ lldb_private::process_linux::GetAvailableLogicalCoreIDs(StringRef cpuinfo) {
 
 llvm::Expected<llvm::ArrayRef<cpu_id_t>>
 lldb_private::process_linux::GetAvailableLogicalCoreIDs() {
-  static Optional<std::vector<cpu_id_t>> logical_cores_ids;
+  static std::optional<std::vector<cpu_id_t>> logical_cores_ids;
   if (!logical_cores_ids) {
     // We find the actual list of core ids by parsing /proc/cpuinfo
     Expected<ArrayRef<uint8_t>> cpuinfo = GetProcfsCpuInfo();

diff  --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
index b9da5e427fd47..b8de5f0848836 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -307,7 +307,7 @@ NativeRegisterContextNetBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
   }
 }
 
-llvm::Optional<NativeRegisterContextNetBSD_x86_64::RegSetKind>
+std::optional<NativeRegisterContextNetBSD_x86_64::RegSetKind>
 NativeRegisterContextNetBSD_x86_64::GetSetForNativeRegNum(
     uint32_t reg_num) const {
   switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
@@ -400,7 +400,7 @@ NativeRegisterContextNetBSD_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.
@@ -429,7 +429,7 @@ NativeRegisterContextNetBSD_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);
@@ -467,7 +467,7 @@ Status NativeRegisterContextNetBSD_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.
@@ -506,7 +506,7 @@ Status NativeRegisterContextNetBSD_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);
@@ -620,7 +620,7 @@ NativeRegisterContextNetBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
   return base + (reg_offset - m_regset_offsets[set]);
 }
 
-llvm::Optional<NativeRegisterContextNetBSD_x86_64::YMMSplitPtr>
+std::optional<NativeRegisterContextNetBSD_x86_64::YMMSplitPtr>
 NativeRegisterContextNetBSD_x86_64::GetYMMSplitReg(uint32_t reg) {
   auto xst = reinterpret_cast<xstate *>(m_xstate.data());
   if (!(xst->xs_rfbm & XCR0_SSE) || !(xst->xs_rfbm & XCR0_YMM_Hi128))

diff  --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
index 642b65470e6b7..e4597b2f69c6c 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
+++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
@@ -72,7 +72,7 @@ class NativeRegisterContextNetBSD_x86_64
   std::array<uint8_t, sizeof(struct dbreg)> m_dbr;
   std::array<size_t, MaxRegularRegSet + 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);
@@ -83,7 +83,7 @@ class NativeRegisterContextNetBSD_x86_64
     void *xmm;
     void *ymm_hi;
   };
-  llvm::Optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg);
+  std::optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg);
 };
 
 } // namespace process_netbsd

diff  --git a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
index 242ea3be42841..23e94a5f55e21 100644
--- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
+++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
@@ -13,7 +13,7 @@
 
 namespace lldb_private {
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 NativeProcessELF::GetAuxValue(enum AuxVector::EntryType type) {
   if (m_aux_vector == nullptr) {
     auto buffer_or_error = GetAuxvData();
@@ -45,11 +45,11 @@ lldb::addr_t NativeProcessELF::GetSharedLibraryInfoAddress() {
 
 template <typename ELF_EHDR, typename ELF_PHDR, typename ELF_DYN>
 lldb::addr_t NativeProcessELF::GetELFImageInfoAddress() {
-  llvm::Optional<uint64_t> maybe_phdr_addr =
+  std::optional<uint64_t> maybe_phdr_addr =
       GetAuxValue(AuxVector::AUXV_AT_PHDR);
-  llvm::Optional<uint64_t> maybe_phdr_entry_size =
+  std::optional<uint64_t> maybe_phdr_entry_size =
       GetAuxValue(AuxVector::AUXV_AT_PHENT);
-  llvm::Optional<uint64_t> maybe_phdr_num_entries =
+  std::optional<uint64_t> maybe_phdr_num_entries =
       GetAuxValue(AuxVector::AUXV_AT_PHNUM);
   if (!maybe_phdr_addr || !maybe_phdr_entry_size || !maybe_phdr_num_entries)
     return LLDB_INVALID_ADDRESS;

diff  --git a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.h b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
index a598fbc12133e..937def94436be 100644
--- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
+++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
@@ -23,7 +23,7 @@ class NativeProcessELF : public NativeProcessProtocol {
   using NativeProcessProtocol::NativeProcessProtocol;
 
 public:
-  llvm::Optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type);
+  std::optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type);
 
 protected:
   template <typename T> struct ELFLinkMap {
@@ -49,7 +49,7 @@ class NativeProcessELF : public NativeProcessProtocol {
   void NotifyDidExec() override;
 
   std::unique_ptr<AuxVector> m_aux_vector;
-  llvm::Optional<lldb::addr_t> m_shared_library_info_addr;
+  std::optional<lldb::addr_t> m_shared_library_info_addr;
 };
 
 // Explicitly declare the two 32/64 bit templates that NativeProcessELF.cpp will

diff  --git a/lldb/source/Plugins/Process/Utility/AuxVector.cpp b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
index ee64e229a4dd4..f495ffb1924e7 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.cpp
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
@@ -30,7 +30,7 @@ void AuxVector::ParseAuxv(const lldb_private::DataExtractor &data) {
   }
 }
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 AuxVector::GetAuxValue(enum EntryType entry_type) const {
   auto it = m_auxv_entries.find(static_cast<uint64_t>(entry_type));
   if (it != m_auxv_entries.end())

diff  --git a/lldb/source/Plugins/Process/Utility/AuxVector.h b/lldb/source/Plugins/Process/Utility/AuxVector.h
index 1eead3fbaf88b..3b0f55d35e5d1 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -62,7 +62,7 @@ class AuxVector {
     AUXV_AT_L3_CACHESHAPE = 37,
   };
 
-  llvm::Optional<uint64_t> GetAuxValue(enum EntryType entry_type) const;
+  std::optional<uint64_t> GetAuxValue(enum EntryType entry_type) const;
   void DumpToLog(lldb_private::Log *log) const;
   const char *GetEntryName(EntryType type) const;
 

diff  --git a/lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp b/lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
index bf45c65682138..fd803c8cabafe 100644
--- a/lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
+++ b/lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
@@ -147,7 +147,7 @@ void lldb_private::ParseLinuxSMapRegions(llvm::StringRef linux_smap,
 
   llvm::StringRef lines(linux_smap);
   llvm::StringRef line;
-  llvm::Optional<MemoryRegionInfo> region;
+  std::optional<MemoryRegionInfo> region;
 
   while (lines.size()) {
     std::tie(line, lines) = lines.split('\n');

diff  --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
index 77c0b8f60b128..aae15b2ef4624 100644
--- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -41,7 +41,7 @@ struct PtrauthInstructionInfo {
 
 /// Get any pointer-authentication related information about the instruction
 /// at address \p at_addr.
-static llvm::Optional<PtrauthInstructionInfo>
+static std::optional<PtrauthInstructionInfo>
 GetPtrauthInstructionInfo(Target &target, const ArchSpec &arch,
                           const Address &at_addr) {
   const char *plugin_name = nullptr;
@@ -569,9 +569,9 @@ StopInfoMachException::MachException::Name(exception_type_t exc_type) {
   return NULL;
 }
 
-llvm::Optional<exception_type_t>
+std::optional<exception_type_t>
 StopInfoMachException::MachException::ExceptionCode(const char *name) {
-  return llvm::StringSwitch<llvm::Optional<exception_type_t>>(name)
+  return llvm::StringSwitch<std::optional<exception_type_t>>(name)
       .Case("EXC_BAD_ACCESS", EXC_BAD_ACCESS)
       .Case("EXC_BAD_INSTRUCTION", EXC_BAD_INSTRUCTION)
       .Case("EXC_ARITHMETIC", EXC_ARITHMETIC)

diff  --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.h b/lldb/source/Plugins/Process/Utility/StopInfoMachException.h
index a22cb856aaaa2..541ef5e69565d 100644
--- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.h
+++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.h
@@ -46,7 +46,7 @@ class StopInfoMachException : public StopInfo {
 #if defined(__APPLE__)
   struct MachException {
     static const char *Name(exception_type_t exc_type);
-    static llvm::Optional<exception_type_t> ExceptionCode(const char *name);
+    static std::optional<exception_type_t> ExceptionCode(const char *name);
   };
 #endif
 

diff  --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
index 7361cae3ac7f1..93227c5524143 100644
--- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -413,7 +413,7 @@ DebuggerThread::HandleExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO &info,
   return DBG_CONTINUE;
 }
 
-static llvm::Optional<std::string> GetFileNameFromHandleFallback(HANDLE hFile) {
+static std::optional<std::string> GetFileNameFromHandleFallback(HANDLE hFile) {
   // Check that file is not empty as we cannot map a file with zero length.
   DWORD dwFileSizeHi = 0;
   DWORD dwFileSizeLo = ::GetFileSize(hFile, &dwFileSizeHi);
@@ -505,7 +505,7 @@ DebuggerThread::HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info,
       path += 4;
 
     on_load_dll(path);
-  } else if (llvm::Optional<std::string> path =
+  } else if (std::optional<std::string> path =
                  GetFileNameFromHandleFallback(info.hFile)) {
     on_load_dll(*path);
   } else {

diff  --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
index 03106c609eae3..7455d78774ee6 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
@@ -12,7 +12,7 @@
 
 using namespace lldb_private;
 
-static llvm::Optional<uint32_t>
+static std::optional<uint32_t>
 getNoteType(const llvm::Triple &Triple,
             llvm::ArrayRef<RegsetDesc> RegsetDescs) {
   for (const auto &Entry : RegsetDescs) {

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 7442f48529a01..6e47e5b3e3d10 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -956,7 +956,7 @@ llvm::VersionTuple GDBRemoteCommunicationClient::GetMacCatalystVersion() {
   return m_maccatalyst_version;
 }
 
-llvm::Optional<std::string> GDBRemoteCommunicationClient::GetOSBuildString() {
+std::optional<std::string> GDBRemoteCommunicationClient::GetOSBuildString() {
   if (GetHostInfo()) {
     if (!m_os_build.empty())
       return m_os_build;
@@ -964,7 +964,7 @@ llvm::Optional<std::string> GDBRemoteCommunicationClient::GetOSBuildString() {
   return std::nullopt;
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 GDBRemoteCommunicationClient::GetOSKernelDescription() {
   if (GetHostInfo()) {
     if (!m_os_kernel.empty())
@@ -2688,10 +2688,8 @@ bool GDBRemoteCommunicationClient::KillSpawnedProcess(lldb::pid_t pid) {
   return false;
 }
 
-llvm::Optional<PidTid>
-GDBRemoteCommunicationClient::SendSetCurrentThreadPacket(uint64_t tid,
-                                                         uint64_t pid,
-                                                         char op) {
+std::optional<PidTid> GDBRemoteCommunicationClient::SendSetCurrentThreadPacket(
+    uint64_t tid, uint64_t pid, char op) {
   lldb_private::StreamString packet;
   packet.PutChar('H');
   packet.PutChar(op);
@@ -2729,7 +2727,7 @@ bool GDBRemoteCommunicationClient::SetCurrentThread(uint64_t tid,
       (m_curr_pid == pid || LLDB_INVALID_PROCESS_ID == pid))
     return true;
 
-  llvm::Optional<PidTid> ret = SendSetCurrentThreadPacket(tid, pid, 'g');
+  std::optional<PidTid> ret = SendSetCurrentThreadPacket(tid, pid, 'g');
   if (ret) {
     if (ret->pid != LLDB_INVALID_PROCESS_ID)
       m_curr_pid = ret->pid;
@@ -2744,7 +2742,7 @@ bool GDBRemoteCommunicationClient::SetCurrentThreadForRun(uint64_t tid,
       (m_curr_pid_run == pid || LLDB_INVALID_PROCESS_ID == pid))
     return true;
 
-  llvm::Optional<PidTid> ret = SendSetCurrentThreadPacket(tid, pid, 'c');
+  std::optional<PidTid> ret = SendSetCurrentThreadPacket(tid, pid, 'c');
   if (ret) {
     if (ret->pid != LLDB_INVALID_PROCESS_ID)
       m_curr_pid_run = ret->pid;
@@ -3088,7 +3086,7 @@ bool GDBRemoteCommunicationClient::CloseFile(lldb::user_id_t fd,
   return false;
 }
 
-llvm::Optional<GDBRemoteFStatData>
+std::optional<GDBRemoteFStatData>
 GDBRemoteCommunicationClient::FStat(lldb::user_id_t fd) {
   lldb_private::StreamString stream;
   stream.Printf("vFile:fstat:%" PRIx64, fd);
@@ -3112,13 +3110,13 @@ GDBRemoteCommunicationClient::FStat(lldb::user_id_t fd) {
   return std::nullopt;
 }
 
-llvm::Optional<GDBRemoteFStatData>
+std::optional<GDBRemoteFStatData>
 GDBRemoteCommunicationClient::Stat(const lldb_private::FileSpec &file_spec) {
   Status error;
   lldb::user_id_t fd = OpenFile(file_spec, File::eOpenOptionReadOnly, 0, error);
   if (fd == UINT64_MAX)
     return std::nullopt;
-  llvm::Optional<GDBRemoteFStatData> st = FStat(fd);
+  std::optional<GDBRemoteFStatData> st = FStat(fd);
   CloseFile(fd, error);
   return st;
 }
@@ -3146,7 +3144,7 @@ lldb::user_id_t GDBRemoteCommunicationClient::GetFileSize(
   }
 
   // Fallback to fstat.
-  llvm::Optional<GDBRemoteFStatData> st = Stat(file_spec);
+  std::optional<GDBRemoteFStatData> st = Stat(file_spec);
   return st ? st->gdb_st_size : UINT64_MAX;
 }
 
@@ -3217,7 +3215,7 @@ GDBRemoteCommunicationClient::GetFilePermissions(const FileSpec &file_spec,
   }
 
   // Fallback to fstat.
-  if (llvm::Optional<GDBRemoteFStatData> st = Stat(file_spec)) {
+  if (std::optional<GDBRemoteFStatData> st = Stat(file_spec)) {
     file_permissions = st->gdb_st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
     return Status();
   }
@@ -3720,7 +3718,7 @@ GDBRemoteCommunicationClient::SendTraceGetBinaryData(
       escaped_packet.GetData());
 }
 
-llvm::Optional<QOffsets> GDBRemoteCommunicationClient::GetQOffsets() {
+std::optional<QOffsets> GDBRemoteCommunicationClient::GetQOffsets() {
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse("qOffsets", response) !=
       PacketResult::Success)
@@ -3826,7 +3824,7 @@ bool GDBRemoteCommunicationClient::GetModuleInfo(
   return true;
 }
 
-static llvm::Optional<ModuleSpec>
+static std::optional<ModuleSpec>
 ParseModuleSpec(StructuredData::Dictionary *dict) {
   ModuleSpec result;
   if (!dict)
@@ -3859,7 +3857,7 @@ ParseModuleSpec(StructuredData::Dictionary *dict) {
   return result;
 }
 
-llvm::Optional<std::vector<ModuleSpec>>
+std::optional<std::vector<ModuleSpec>>
 GDBRemoteCommunicationClient::GetModulesInfo(
     llvm::ArrayRef<FileSpec> module_file_specs, const llvm::Triple &triple) {
   namespace json = llvm::json;
@@ -3906,7 +3904,7 @@ GDBRemoteCommunicationClient::GetModulesInfo(
 
   std::vector<ModuleSpec> result;
   for (size_t i = 0; i < response_array->GetSize(); ++i) {
-    if (llvm::Optional<ModuleSpec> module_spec = ParseModuleSpec(
+    if (std::optional<ModuleSpec> module_spec = ParseModuleSpec(
             response_array->GetItemAtIndex(i)->GetAsDictionary()))
       result.push_back(*module_spec);
   }

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index c48852bec1f20..d3b03446092f7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -236,9 +236,9 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
 
   llvm::VersionTuple GetMacCatalystVersion();
 
-  llvm::Optional<std::string> GetOSBuildString();
+  std::optional<std::string> GetOSBuildString();
 
-  llvm::Optional<std::string> GetOSKernelDescription();
+  std::optional<std::string> GetOSKernelDescription();
 
   ArchSpec GetSystemArchitecture();
 
@@ -300,8 +300,8 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
   // and response times.
   bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size);
 
-  llvm::Optional<PidTid>
-  SendSetCurrentThreadPacket(uint64_t tid, uint64_t pid, char op);
+  std::optional<PidTid> SendSetCurrentThreadPacket(uint64_t tid, uint64_t pid,
+                                                   char op);
 
   bool SetCurrentThread(uint64_t tid,
                         lldb::pid_t pid = LLDB_INVALID_PROCESS_ID);
@@ -352,11 +352,11 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
 
   bool CloseFile(lldb::user_id_t fd, Status &error);
 
-  llvm::Optional<GDBRemoteFStatData> FStat(lldb::user_id_t fd);
+  std::optional<GDBRemoteFStatData> FStat(lldb::user_id_t fd);
 
   // NB: this is just a convenience wrapper over open() + fstat().  It does not
   // work if the file cannot be opened.
-  llvm::Optional<GDBRemoteFStatData> Stat(const FileSpec &file_spec);
+  std::optional<GDBRemoteFStatData> Stat(const FileSpec &file_spec);
 
   lldb::user_id_t GetFileSize(const FileSpec &file_spec);
 
@@ -445,12 +445,12 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
   /// Use qOffsets to query the offset used when relocating the target
   /// executable. If successful, the returned structure will contain at least
   /// one value in the offsets field.
-  llvm::Optional<QOffsets> GetQOffsets();
+  std::optional<QOffsets> GetQOffsets();
 
   bool GetModuleInfo(const FileSpec &module_file_spec,
                      const ArchSpec &arch_spec, ModuleSpec &module_spec);
 
-  llvm::Optional<std::vector<ModuleSpec>>
+  std::optional<std::vector<ModuleSpec>>
   GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs,
                  const llvm::Triple &triple);
 

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index c038ff736ae52..f71240672bccc 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -267,12 +267,12 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo(
   }
 #endif
 
-  if (llvm::Optional<std::string> s = HostInfo::GetOSBuildString()) {
+  if (std::optional<std::string> s = HostInfo::GetOSBuildString()) {
     response.PutCString("os_build:");
     response.PutStringAsRawHex8(*s);
     response.PutChar(';');
   }
-  if (llvm::Optional<std::string> s = HostInfo::GetOSKernelDescription()) {
+  if (std::optional<std::string> s = HostInfo::GetOSKernelDescription()) {
     response.PutCString("os_kernel:");
     response.PutStringAsRawHex8(*s);
     response.PutChar(';');
@@ -433,7 +433,7 @@ GDBRemoteCommunicationServerCommon::Handle_qUserName(
   packet.SetFilePos(::strlen("qUserName:"));
   uint32_t uid = packet.GetU32(UINT32_MAX);
   if (uid != UINT32_MAX) {
-    if (llvm::Optional<llvm::StringRef> name =
+    if (std::optional<llvm::StringRef> name =
             HostInfo::GetUserIDResolver().GetUserName(uid)) {
       StreamString response;
       response.PutStringAsRawHex8(*name);
@@ -453,7 +453,7 @@ GDBRemoteCommunicationServerCommon::Handle_qGroupName(
   packet.SetFilePos(::strlen("qGroupName:"));
   uint32_t gid = packet.GetU32(UINT32_MAX);
   if (gid != UINT32_MAX) {
-    if (llvm::Optional<llvm::StringRef> name =
+    if (std::optional<llvm::StringRef> name =
             HostInfo::GetUserIDResolver().GetGroupName(gid)) {
       StreamString response;
       response.PutStringAsRawHex8(*name);

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 03a2e73aaedf0..30d6d786b8651 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -639,7 +639,7 @@ static void WriteRegisterValueInHexFixedWidth(
   }
 }
 
-static llvm::Optional<json::Object>
+static std::optional<json::Object>
 GetRegistersAsJSON(NativeThreadProtocol &thread) {
   Log *log = GetLog(LLDBLog::Thread);
 
@@ -753,7 +753,7 @@ GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) {
     json::Object thread_obj;
 
     if (!abridged) {
-      if (llvm::Optional<json::Object> registers = GetRegistersAsJSON(thread))
+      if (std::optional<json::Object> registers = GetRegistersAsJSON(thread))
         thread_obj.try_emplace("registers", std::move(*registers));
     }
 
@@ -4279,7 +4279,7 @@ std::string
 lldb_private::process_gdb_remote::LLGSArgToURL(llvm::StringRef url_arg,
                                                bool reverse_connect) {
   // Try parsing the argument as URL.
-  if (llvm::Optional<URI> url = URI::Parse(url_arg)) {
+  if (std::optional<URI> url = URI::Parse(url_arg)) {
     if (reverse_connect)
       return url_arg.str();
 

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index e4187ef44e98a..bdb6480ff4d90 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -159,7 +159,7 @@ GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform() =
 
 Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
     const lldb_private::Args &args, std::string hostname, lldb::pid_t &pid,
-    llvm::Optional<uint16_t> &port, std::string &socket_name) {
+    std::optional<uint16_t> &port, std::string &socket_name) {
   if (!port) {
     llvm::Expected<uint16_t> available_port = m_port_map.GetNextAvailablePort();
     if (available_port)
@@ -198,7 +198,7 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
   uint16_t *port_ptr = &*port;
   if (m_socket_protocol == Socket::ProtocolTcp) {
     std::string platform_uri = GetConnection()->GetURI();
-    llvm::Optional<URI> parsed_uri = URI::Parse(platform_uri);
+    std::optional<URI> parsed_uri = URI::Parse(platform_uri);
     url << '[' << parsed_uri->hostname.str() << "]:" << *port;
   } else {
     socket_name = GetDomainSocketPath("gdbserver").GetPath();
@@ -237,7 +237,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
   packet.SetFilePos(::strlen("qLaunchGDBServer;"));
   llvm::StringRef name;
   llvm::StringRef value;
-  llvm::Optional<uint16_t> port;
+  std::optional<uint16_t> port;
   while (packet.GetNameColonValue(name, value)) {
     if (name.equals("host"))
       hostname = std::string(value);

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
index 397d733ea0cab..97805f2130b81 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
@@ -91,7 +91,7 @@ class GDBRemoteCommunicationServerPlatform
   // Set port if you want to use a specific port number.
   // Otherwise port will be set to the port that was chosen for you.
   Status LaunchGDBServer(const lldb_private::Args &args, std::string hostname,
-                         lldb::pid_t &pid, llvm::Optional<uint16_t> &port,
+                         lldb::pid_t &pid, std::optional<uint16_t> &port,
                          std::string &socket_name);
 
   void SetPendingGdbServer(lldb::pid_t pid, uint16_t port,

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3c8fb9339aaa7..2f3a81fedd0b9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1033,7 +1033,7 @@ void ProcessGDBRemote::MaybeLoadExecutableModule() {
   if (!module_sp)
     return;
 
-  llvm::Optional<QOffsets> offsets = m_gdb_comm.GetQOffsets();
+  std::optional<QOffsets> offsets = m_gdb_comm.GetQOffsets();
   if (!offsets)
     return;
 

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 4b464282397fa..aae643240702e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -254,7 +254,7 @@ class ProcessGDBRemote : public Process,
   GDBRemoteCommunicationClient m_gdb_comm;
   std::atomic<lldb::pid_t> m_debugserver_pid;
 
-  llvm::Optional<StringExtractorGDBRemote> m_last_stop_packet;
+  std::optional<StringExtractorGDBRemote> m_last_stop_packet;
   std::recursive_mutex m_last_stop_packet_mutex;
 
   GDBRemoteDynamicRegisterInfoSP m_register_info_sp;

diff  --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
index 33bb7c4bc7194..be9fae938e227 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -221,7 +221,7 @@ const MinidumpMiscInfo *MinidumpParser::GetMiscInfo() {
   return MinidumpMiscInfo::Parse(data);
 }
 
-llvm::Optional<LinuxProcStatus> MinidumpParser::GetLinuxProcStatus() {
+std::optional<LinuxProcStatus> MinidumpParser::GetLinuxProcStatus() {
   llvm::ArrayRef<uint8_t> data = GetStream(StreamType::LinuxProcStatus);
 
   if (data.size() == 0)
@@ -230,13 +230,13 @@ llvm::Optional<LinuxProcStatus> MinidumpParser::GetLinuxProcStatus() {
   return LinuxProcStatus::Parse(data);
 }
 
-llvm::Optional<lldb::pid_t> MinidumpParser::GetPid() {
+std::optional<lldb::pid_t> MinidumpParser::GetPid() {
   const MinidumpMiscInfo *misc_info = GetMiscInfo();
   if (misc_info != nullptr) {
     return misc_info->GetPid();
   }
 
-  llvm::Optional<LinuxProcStatus> proc_status = GetLinuxProcStatus();
+  std::optional<LinuxProcStatus> proc_status = GetLinuxProcStatus();
   if (proc_status) {
     return proc_status->GetPid();
   }
@@ -427,7 +427,7 @@ const minidump::ExceptionStream *MinidumpParser::GetExceptionStream() {
   return nullptr;
 }
 
-llvm::Optional<minidump::Range>
+std::optional<minidump::Range>
 MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
   llvm::ArrayRef<uint8_t> data64 = GetStream(StreamType::Memory64List);
   Log *log = GetLog(LLDBLog::Modules);
@@ -495,7 +495,7 @@ llvm::ArrayRef<uint8_t> MinidumpParser::GetMemory(lldb::addr_t addr,
   // ranges a Minidump typically has, so I'm not sure if searching for the
   // appropriate range linearly each time is stupid.  Perhaps we should build
   // an index for faster lookups.
-  llvm::Optional<minidump::Range> range = FindMemoryRange(addr);
+  std::optional<minidump::Range> range = FindMemoryRange(addr);
   if (!range)
     return {};
 

diff  --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.h b/lldb/source/Plugins/Process/minidump/MinidumpParser.h
index f6486b76eb0e4..083131450d5e1 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.h
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.h
@@ -71,9 +71,9 @@ class MinidumpParser {
 
   const MinidumpMiscInfo *GetMiscInfo();
 
-  llvm::Optional<LinuxProcStatus> GetLinuxProcStatus();
+  std::optional<LinuxProcStatus> GetLinuxProcStatus();
 
-  llvm::Optional<lldb::pid_t> GetPid();
+  std::optional<lldb::pid_t> GetPid();
 
   llvm::ArrayRef<minidump::Module> GetModuleList();
 
@@ -85,7 +85,7 @@ class MinidumpParser {
 
   const llvm::minidump::ExceptionStream *GetExceptionStream();
 
-  llvm::Optional<Range> FindMemoryRange(lldb::addr_t addr);
+  std::optional<Range> FindMemoryRange(lldb::addr_t addr);
 
   llvm::ArrayRef<uint8_t> GetMemory(lldb::addr_t addr, size_t size);
 

diff  --git a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
index 4685f5a83c0d0..b2f1fe9523326 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -25,17 +25,17 @@ const MinidumpMiscInfo *MinidumpMiscInfo::Parse(llvm::ArrayRef<uint8_t> &data) {
   return misc_info;
 }
 
-llvm::Optional<lldb::pid_t> MinidumpMiscInfo::GetPid() const {
+std::optional<lldb::pid_t> MinidumpMiscInfo::GetPid() const {
   uint32_t pid_flag = static_cast<uint32_t>(MinidumpMiscInfoFlags::ProcessID);
   if (flags1 & pid_flag)
-    return llvm::Optional<lldb::pid_t>(process_id);
+    return std::optional<lldb::pid_t>(process_id);
 
   return std::nullopt;
 }
 
 // Linux Proc Status
 // it's stored as an ascii string in the file
-llvm::Optional<LinuxProcStatus>
+std::optional<LinuxProcStatus>
 LinuxProcStatus::Parse(llvm::ArrayRef<uint8_t> &data) {
   LinuxProcStatus result;
   result.proc_status =

diff  --git a/lldb/source/Plugins/Process/minidump/MinidumpTypes.h b/lldb/source/Plugins/Process/minidump/MinidumpTypes.h
index 4692ea281163f..8c80a8cfa083a 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpTypes.h
+++ b/lldb/source/Plugins/Process/minidump/MinidumpTypes.h
@@ -84,7 +84,7 @@ struct MinidumpMiscInfo {
 
   static const MinidumpMiscInfo *Parse(llvm::ArrayRef<uint8_t> &data);
 
-  llvm::Optional<lldb::pid_t> GetPid() const;
+  std::optional<lldb::pid_t> GetPid() const;
 };
 static_assert(sizeof(MinidumpMiscInfo) == 24,
               "sizeof MinidumpMiscInfo is not correct!");
@@ -95,7 +95,7 @@ class LinuxProcStatus {
   llvm::StringRef proc_status;
   lldb::pid_t pid;
 
-  static llvm::Optional<LinuxProcStatus> Parse(llvm::ArrayRef<uint8_t> &data);
+  static std::optional<LinuxProcStatus> Parse(llvm::ArrayRef<uint8_t> &data);
 
   lldb::pid_t GetPid() const;
 

diff  --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index b3c961c197530..5911b137ef419 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -293,7 +293,7 @@ Status ProcessMinidump::DoLoadCore() {
   ReadModuleList();
   if (ModuleSP module = GetTarget().GetExecutableModule())
     GetTarget().MergeArchitecture(module->GetArchitecture());
-  llvm::Optional<lldb::pid_t> pid = m_minidump_parser->GetPid();
+  std::optional<lldb::pid_t> pid = m_minidump_parser->GetPid();
   if (!pid) {
     Debugger::ReportWarning("unable to retrieve process ID from minidump file, "
                             "setting process ID to 1",

diff  --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
index bfffa951a0679..0e4e52c0113fb 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -87,7 +87,7 @@ class ProcessMinidump : public PostMortemProcess {
     return error;
   }
 
-  llvm::Optional<MinidumpParser> m_minidump_parser;
+  std::optional<MinidumpParser> m_minidump_parser;
 
 protected:
   void Clear();
@@ -113,7 +113,7 @@ class ProcessMinidump : public PostMortemProcess {
   const minidump::ExceptionStream *m_active_exception;
   lldb::CommandObjectSP m_command_sp;
   bool m_is_wow64;
-  llvm::Optional<MemoryRegionInfos> m_memory_regions;
+  std::optional<MemoryRegionInfos> m_memory_regions;
 
   void BuildMemoryRegions();
 };

diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
index 76bde531179cc..c2f01395f09dc 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -46,7 +46,7 @@ ScriptedThread::Create(ScriptedProcess &process,
 
   llvm::StringRef thread_class_name;
   if (!script_object) {
-    llvm::Optional<std::string> class_name =
+    std::optional<std::string> class_name =
         process.GetInterface().GetScriptedThreadPluginName();
     if (!class_name || class_name->empty())
       return llvm::createStringError(
@@ -86,7 +86,7 @@ ScriptedThread::~ScriptedThread() { DestroyThread(); }
 
 const char *ScriptedThread::GetName() {
   CheckInterpreterAndScriptObject();
-  llvm::Optional<std::string> thread_name = GetInterface()->GetName();
+  std::optional<std::string> thread_name = GetInterface()->GetName();
   if (!thread_name)
     return nullptr;
   return ConstString(thread_name->c_str()).AsCString();
@@ -94,7 +94,7 @@ const char *ScriptedThread::GetName() {
 
 const char *ScriptedThread::GetQueueName() {
   CheckInterpreterAndScriptObject();
-  llvm::Optional<std::string> queue_name = GetInterface()->GetQueue();
+  std::optional<std::string> queue_name = GetInterface()->GetQueue();
   if (!queue_name)
     return nullptr;
   return ConstString(queue_name->c_str()).AsCString();
@@ -121,7 +121,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) {
   lldb::RegisterContextSP reg_ctx_sp;
   Status error;
 
-  llvm::Optional<std::string> reg_data = GetInterface()->GetRegisterContext();
+  std::optional<std::string> reg_data = GetInterface()->GetRegisterContext();
   if (!reg_data)
     return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
         LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers data.",

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
index a09dfb4bf71b3..35c96215d4a58 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -212,7 +212,7 @@ bool LLDBSWIGPythonRunScriptKeywordProcess(const char *python_function_name,
                                            const lldb::ProcessSP &process,
                                            std::string &output);
 
-llvm::Optional<std::string>
+std::optional<std::string>
 LLDBSWIGPythonRunScriptKeywordThread(const char *python_function_name,
                                      const char *session_dictionary_name,
                                      lldb::ThreadSP thread);
@@ -222,7 +222,7 @@ bool LLDBSWIGPythonRunScriptKeywordTarget(const char *python_function_name,
                                           const lldb::TargetSP &target,
                                           std::string &output);
 
-llvm::Optional<std::string>
+std::optional<std::string>
 LLDBSWIGPythonRunScriptKeywordFrame(const char *python_function_name,
                                     const char *session_dictionary_name,
                                     lldb::StackFrameSP frame);

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 3cff7faca375e..7101db0120d37 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2426,7 +2426,7 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
 
   Locker py_lock(this,
                  Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-  if (llvm::Optional<std::string> result = LLDBSWIGPythonRunScriptKeywordThread(
+  if (std::optional<std::string> result = LLDBSWIGPythonRunScriptKeywordThread(
           impl_function, m_dictionary_name.c_str(),
           thread->shared_from_this())) {
     output = std::move(*result);
@@ -2475,7 +2475,7 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
 
   Locker py_lock(this,
                  Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-  if (llvm::Optional<std::string> result = LLDBSWIGPythonRunScriptKeywordFrame(
+  if (std::optional<std::string> result = LLDBSWIGPythonRunScriptKeywordFrame(
           impl_function, m_dictionary_name.c_str(),
           frame->shared_from_this())) {
     output = std::move(*result);

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
index 311da2b6e3f71..5fd085df26a8e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
@@ -76,10 +76,10 @@ Status ScriptedProcessPythonInterface::Stop() {
   return GetStatusFromMethod("stop");
 }
 
-llvm::Optional<MemoryRegionInfo>
+std::optional<MemoryRegionInfo>
 ScriptedProcessPythonInterface::GetMemoryRegionContainingAddress(
     lldb::addr_t address, Status &error) {
-  auto mem_region = Dispatch<llvm::Optional<MemoryRegionInfo>>(
+  auto mem_region = Dispatch<std::optional<MemoryRegionInfo>>(
       "get_memory_region_containing_address", error, address);
 
   if (error.Fail()) {
@@ -170,7 +170,7 @@ bool ScriptedProcessPythonInterface::IsAlive() {
   return obj->GetBooleanValue();
 }
 
-llvm::Optional<std::string>
+std::optional<std::string>
 ScriptedProcessPythonInterface::GetScriptedThreadPluginName() {
   Status error;
   StructuredData::ObjectSP obj = Dispatch("get_scripted_thread_plugin", error);

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
index 680b8337a328a..6b4ee3021cfa4 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
@@ -37,7 +37,7 @@ class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
 
   Status Stop() override;
 
-  llvm::Optional<MemoryRegionInfo>
+  std::optional<MemoryRegionInfo>
   GetMemoryRegionContainingAddress(lldb::addr_t address,
                                    Status &error) override;
 
@@ -56,7 +56,7 @@ class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
 
   bool IsAlive() override;
 
-  llvm::Optional<std::string> GetScriptedThreadPluginName() override;
+  std::optional<std::string> GetScriptedThreadPluginName() override;
 
   StructuredData::DictionarySP GetMetadata() override;
 

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
index ee906662be1b5..10c22df5475d4 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
@@ -80,9 +80,9 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
 }
 
 template <>
-llvm::Optional<MemoryRegionInfo>
+std::optional<MemoryRegionInfo>
 ScriptedPythonInterface::ExtractValueFromPythonObject<
-    llvm::Optional<MemoryRegionInfo>>(python::PythonObject &p, Status &error) {
+    std::optional<MemoryRegionInfo>>(python::PythonObject &p, Status &error) {
 
   lldb::SBMemoryRegionInfo *sb_mem_reg_info =
       reinterpret_cast<lldb::SBMemoryRegionInfo *>(

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
index 6d77a0ae64c9e..cc936e09a6ef2 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
@@ -198,9 +198,9 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
     python::PythonObject &p, Status &error);
 
 template <>
-llvm::Optional<MemoryRegionInfo>
+std::optional<MemoryRegionInfo>
 ScriptedPythonInterface::ExtractValueFromPythonObject<
-    llvm::Optional<MemoryRegionInfo>>(python::PythonObject &p, Status &error);
+    std::optional<MemoryRegionInfo>>(python::PythonObject &p, Status &error);
 
 } // namespace lldb_private
 

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
index 2df332575e02e..21d2ed35250f2 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
@@ -71,7 +71,7 @@ lldb::tid_t ScriptedThreadPythonInterface::GetThreadID() {
   return obj->GetIntegerValue(LLDB_INVALID_THREAD_ID);
 }
 
-llvm::Optional<std::string> ScriptedThreadPythonInterface::GetName() {
+std::optional<std::string> ScriptedThreadPythonInterface::GetName() {
   Status error;
   StructuredData::ObjectSP obj = Dispatch("get_name", error);
 
@@ -91,7 +91,7 @@ lldb::StateType ScriptedThreadPythonInterface::GetState() {
   return static_cast<StateType>(obj->GetIntegerValue(eStateInvalid));
 }
 
-llvm::Optional<std::string> ScriptedThreadPythonInterface::GetQueue() {
+std::optional<std::string> ScriptedThreadPythonInterface::GetQueue() {
   Status error;
   StructuredData::ObjectSP obj = Dispatch("get_queue", error);
 
@@ -134,8 +134,7 @@ StructuredData::DictionarySP ScriptedThreadPythonInterface::GetRegisterInfo() {
   return dict;
 }
 
-llvm::Optional<std::string>
-ScriptedThreadPythonInterface::GetRegisterContext() {
+std::optional<std::string> ScriptedThreadPythonInterface::GetRegisterContext() {
   Status error;
   StructuredData::ObjectSP obj = Dispatch("get_register_context", error);
 

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h
index 3b7fec64a2baa..eac4941f88145 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h
@@ -30,11 +30,11 @@ class ScriptedThreadPythonInterface : public ScriptedThreadInterface,
 
   lldb::tid_t GetThreadID() override;
 
-  llvm::Optional<std::string> GetName() override;
+  std::optional<std::string> GetName() override;
 
   lldb::StateType GetState() override;
 
-  llvm::Optional<std::string> GetQueue() override;
+  std::optional<std::string> GetQueue() override;
 
   StructuredData::DictionarySP GetStopReason() override;
 
@@ -42,7 +42,7 @@ class ScriptedThreadPythonInterface : public ScriptedThreadInterface,
 
   StructuredData::DictionarySP GetRegisterInfo() override;
 
-  llvm::Optional<std::string> GetRegisterContext() override;
+  std::optional<std::string> GetRegisterContext() override;
 
   StructuredData::ArraySP GetExtendedInfo() override;
 };

diff  --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 99fcd266cef0e..6d916df65b9df 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -470,7 +470,7 @@ void SymbolFileBreakpad::AddSymbols(Symtab &symtab) {
   const SectionList &list = *module.GetSectionList();
   llvm::DenseSet<addr_t> found_symbol_addresses;
   std::vector<Symbol> symbols;
-  auto add_symbol = [&](addr_t address, llvm::Optional<addr_t> size,
+  auto add_symbol = [&](addr_t address, std::optional<addr_t> size,
                         llvm::StringRef name) {
     address += base;
     SectionSP section_sp = list.FindSectionContainingFileAddress(address);
@@ -520,7 +520,7 @@ SymbolFileBreakpad::GetParameterStackSize(Symbol &symbol) {
                                  "Parameter size unknown.");
 }
 
-static llvm::Optional<std::pair<llvm::StringRef, llvm::StringRef>>
+static std::optional<std::pair<llvm::StringRef, llvm::StringRef>>
 GetRule(llvm::StringRef &unwind_rules) {
   // Unwind rules are of the form
   //   register1: expression1 register2: expression2 ...
@@ -656,7 +656,7 @@ SymbolFileBreakpad::ParseCFIUnwindPlan(const Bookmark &bookmark,
 
   LineIterator It(*m_objfile_sp, Record::StackCFI, bookmark),
       End(*m_objfile_sp);
-  llvm::Optional<StackCFIRecord> init_record = StackCFIRecord::parse(*It);
+  std::optional<StackCFIRecord> init_record = StackCFIRecord::parse(*It);
   assert(init_record && init_record->Size &&
          "Record already parsed successfully in ParseUnwindData!");
 
@@ -675,7 +675,7 @@ SymbolFileBreakpad::ParseCFIUnwindPlan(const Bookmark &bookmark,
     return nullptr;
   plan_sp->AppendRow(row_sp);
   for (++It; It != End; ++It) {
-    llvm::Optional<StackCFIRecord> record = StackCFIRecord::parse(*It);
+    std::optional<StackCFIRecord> record = StackCFIRecord::parse(*It);
     if (!record)
       return nullptr;
     if (record->Size)
@@ -699,7 +699,7 @@ SymbolFileBreakpad::ParseWinUnwindPlan(const Bookmark &bookmark,
     return nullptr;
 
   LineIterator It(*m_objfile_sp, Record::StackWin, bookmark);
-  llvm::Optional<StackWinRecord> record = StackWinRecord::parse(*It);
+  std::optional<StackWinRecord> record = StackWinRecord::parse(*It);
   assert(record && "Record already parsed successfully in ParseUnwindData!");
 
   auto plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindLLDB);
@@ -849,7 +849,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu,
   std::vector<std::unique_ptr<LineSequence>> sequences;
   std::unique_ptr<LineSequence> line_seq_up =
       LineTable::CreateLineSequenceContainer();
-  llvm::Optional<addr_t> next_addr;
+  std::optional<addr_t> next_addr;
   auto finish_sequence = [&]() {
     LineTable::AppendLineEntryToSequence(
         line_seq_up.get(), *next_addr, /*line=*/0, /*column=*/0,

diff  --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
index 2b0e9aecd8eb6..6d93369665170 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -93,7 +93,7 @@ class SymbolFileBreakpad : public SymbolFileCommon {
     return 0;
   }
   Type *ResolveTypeUID(lldb::user_id_t type_uid) override { return nullptr; }
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override {
     return std::nullopt;
@@ -202,7 +202,7 @@ class SymbolFileBreakpad : public SymbolFileCommon {
     }
 
     Bookmark bookmark;
-    llvm::Optional<FileSpecList> support_files;
+    std::optional<FileSpecList> support_files;
     std::unique_ptr<LineTable> line_table_up;
 
   };
@@ -227,16 +227,16 @@ class SymbolFileBreakpad : public SymbolFileCommon {
 
   using CompUnitMap = RangeDataVector<lldb::addr_t, lldb::addr_t, CompUnitData>;
 
-  llvm::Optional<std::vector<FileSpec>> m_files;
-  llvm::Optional<CompUnitMap> m_cu_data;
-  llvm::Optional<std::vector<llvm::StringRef>> m_inline_origins;
+  std::optional<std::vector<FileSpec>> m_files;
+  std::optional<CompUnitMap> m_cu_data;
+  std::optional<std::vector<llvm::StringRef>> m_inline_origins;
 
   using UnwindMap = RangeDataVector<lldb::addr_t, lldb::addr_t, Bookmark>;
   struct UnwindData {
     UnwindMap cfi;
     UnwindMap win;
   };
-  llvm::Optional<UnwindData> m_unwind_data;
+  std::optional<UnwindData> m_unwind_data;
   llvm::BumpPtrAllocator m_allocator;
 };
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
index f6a9b601d3b48..53e154fd651d8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
@@ -27,8 +27,8 @@ constexpr uint32_t k_dwo_num_mask = 0x3FFFFFFF;
 constexpr uint32_t k_dwo_num_valid_bitmask = (1u << 30);
 constexpr uint32_t k_section_bitmask = (1u << 31);
 
-llvm::Optional<DIERef> DIERef::Decode(const DataExtractor &data,
-                                      lldb::offset_t *offset_ptr) {
+std::optional<DIERef> DIERef::Decode(const DataExtractor &data,
+                                     lldb::offset_t *offset_ptr) {
   const uint32_t bitfield_storage = data.GetU32(offset_ptr);
   uint32_t dwo_num = bitfield_storage & k_dwo_num_mask;
   bool dwo_num_valid = (bitfield_storage & (k_dwo_num_valid_bitmask)) != 0;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index c141151710c93..72238e3f59ca7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -28,14 +28,14 @@ class DIERef {
 public:
   enum Section : uint8_t { DebugInfo, DebugTypes };
 
-  DIERef(llvm::Optional<uint32_t> dwo_num, Section section,
+  DIERef(std::optional<uint32_t> dwo_num, Section section,
          dw_offset_t die_offset)
       : m_dwo_num(dwo_num.value_or(0)), m_dwo_num_valid(bool(dwo_num)),
         m_section(section), m_die_offset(die_offset) {
     assert(this->dwo_num() == dwo_num && "Dwo number out of range?");
   }
 
-  llvm::Optional<uint32_t> dwo_num() const {
+  std::optional<uint32_t> dwo_num() const {
     if (m_dwo_num_valid)
       return m_dwo_num;
     return std::nullopt;
@@ -74,8 +74,8 @@ class DIERef {
   /// \return
   ///   Returns a valid DIERef if decoding succeeded, std::nullopt if there was
   ///   unsufficient or invalid values that were decoded.
-  static llvm::Optional<DIERef> Decode(const lldb_private::DataExtractor &data,
-                                       lldb::offset_t *offset_ptr);
+  static std::optional<DIERef> Decode(const lldb_private::DataExtractor &data,
+                                      lldb::offset_t *offset_ptr);
 
   /// Encode this object into a data encoder object.
   ///

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
index 8144205aa7784..dbece346b99a7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -19,7 +19,7 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::dwarf;
 
-llvm::Optional<SymbolFile::ArrayInfo>
+std::optional<SymbolFile::ArrayInfo>
 DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die,
                                     const ExecutionContext *exe_ctx) {
   SymbolFile::ArrayInfo array_info;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
index dfd22b55b2271..18825ae060b12 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -59,7 +59,7 @@ class DWARFASTParser {
   virtual lldb_private::ConstString
   GetDIEClassTemplateParams(const DWARFDIE &die) = 0;
 
-  static llvm::Optional<lldb_private::SymbolFile::ArrayInfo>
+  static std::optional<lldb_private::SymbolFile::ArrayInfo>
   ParseChildArrayInfo(const DWARFDIE &parent_die,
                       const lldb_private::ExecutionContext *exe_ctx = nullptr);
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 5acb70dd0cf39..07fd946739e3d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1323,7 +1323,7 @@ DWARFASTParserClang::ParseArrayType(const DWARFDIE &die,
   if (!element_type)
     return nullptr;
 
-  llvm::Optional<SymbolFile::ArrayInfo> array_info = ParseChildArrayInfo(die);
+  std::optional<SymbolFile::ArrayInfo> array_info = ParseChildArrayInfo(die);
   uint32_t byte_stride = attrs.byte_stride;
   uint32_t bit_stride = attrs.bit_stride;
   if (array_info) {
@@ -1377,7 +1377,7 @@ TypeSP DWARFASTParserClang::ParsePointerToMemberType(
   CompilerType clang_type = TypeSystemClang::CreateMemberPointerType(
       class_clang_type, pointee_clang_type);
 
-  if (llvm::Optional<uint64_t> clang_type_size =
+  if (std::optional<uint64_t> clang_type_size =
           clang_type.GetByteSize(nullptr)) {
     return std::make_shared<Type>(die.GetID(), dwarf, attrs.name,
                                   *clang_type_size, nullptr, LLDB_INVALID_UID,
@@ -2071,7 +2071,7 @@ bool DWARFASTParserClang::ParseTemplateDIE(
         clang_type.IsIntegerOrEnumerationType(is_signed);
 
         if (tag == DW_TAG_template_value_parameter && uval64_valid) {
-          llvm::Optional<uint64_t> size = clang_type.GetBitSize(nullptr);
+          std::optional<uint64_t> size = clang_type.GetBitSize(nullptr);
           if (!size)
             return false;
           llvm::APInt apint(*size, uval64, is_signed);
@@ -2481,8 +2481,8 @@ struct MemberAttributes {
   size_t bit_size = 0;
   uint64_t data_bit_offset = UINT64_MAX;
   AccessType accessibility = eAccessNone;
-  llvm::Optional<uint64_t> byte_size;
-  llvm::Optional<DWARFFormValue> const_value_form;
+  std::optional<uint64_t> byte_size;
+  std::optional<DWARFFormValue> const_value_form;
   DWARFFormValue encoding_form;
   /// Indicates the byte offset of the word from the base address of the
   /// structure.
@@ -2886,7 +2886,7 @@ void DWARFASTParserClang::ParseSingleMember(
           die.GetCU()->Supports_unnamed_objc_bitfields();
 
     if (detect_unnamed_bitfields) {
-      llvm::Optional<FieldInfo> unnamed_field_info;
+      std::optional<FieldInfo> unnamed_field_info;
       uint64_t last_field_end = 0;
 
       last_field_end = last_field_info.bit_offset + last_field_info.bit_size;
@@ -2938,7 +2938,7 @@ void DWARFASTParserClang::ParseSingleMember(
   } else {
     last_field_info.bit_offset = field_bit_offset;
 
-    if (llvm::Optional<uint64_t> clang_type_size =
+    if (std::optional<uint64_t> clang_type_size =
             member_type->GetByteSize(nullptr)) {
       last_field_info.bit_size = *clang_type_size * character_width;
     }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 431ee348f2107..c078d997df9f3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -325,7 +325,7 @@ struct ParsedDWARFTypeAttributes {
   DWARFFormValue specification;
   DWARFFormValue type;
   lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
-  llvm::Optional<uint64_t> byte_size;
+  std::optional<uint64_t> byte_size;
   size_t calling_convention = llvm::dwarf::DW_CC_normal;
   uint32_t bit_stride = 0;
   uint32_t byte_stride = 0;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
index 6c1e5bcab28f9..e631f99f09a08 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
@@ -19,7 +19,7 @@
 
 using namespace lldb_private;
 
-llvm::Optional<DIERef> DWARFBaseDIE::GetDIERef() const {
+std::optional<DIERef> DWARFBaseDIE::GetDIERef() const {
   if (!IsValid())
     return std::nullopt;
 
@@ -54,7 +54,7 @@ uint64_t DWARFBaseDIE::GetAttributeValueAsUnsigned(const dw_attr_t attr,
     return fail_value;
 }
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 DWARFBaseDIE::GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const {
   if (IsValid())
     return m_die->GetAttributeValueAsOptionalUnsigned(GetCU(), attr);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
index 315eb793f8ca5..51145ab0c4dcb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
@@ -56,7 +56,7 @@ class DWARFBaseDIE {
 
   DWARFDebugInfoEntry *GetDIE() const { return m_die; }
 
-  llvm::Optional<DIERef> GetDIERef() const;
+  std::optional<DIERef> GetDIERef() const;
 
   void Set(DWARFUnit *cu, DWARFDebugInfoEntry *die) {
     if (cu && die) {
@@ -108,7 +108,7 @@ class DWARFBaseDIE {
   uint64_t GetAttributeValueAsUnsigned(const dw_attr_t attr,
                                        uint64_t fail_value) const;
 
-  llvm::Optional<uint64_t>
+  std::optional<uint64_t>
   GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const;
 
   uint64_t GetAttributeValueAsAddress(const dw_attr_t attr,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
index e0f02faf7e14a..f72dad88e1575 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -29,8 +29,8 @@ static DWARFDataExtractor LoadSection(SectionList *section_list,
 }
 
 const DWARFDataExtractor &
-DWARFContext::LoadOrGetSection(llvm::Optional<SectionType> main_section_type,
-                               llvm::Optional<SectionType> dwo_section_type,
+DWARFContext::LoadOrGetSection(std::optional<SectionType> main_section_type,
+                               std::optional<SectionType> dwo_section_type,
                                SectionData &data) {
   llvm::call_once(data.flag, [&] {
     if (dwo_section_type && isDwo())

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
index d4390a5039e51..cc5168cb0ee1e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
@@ -47,8 +47,8 @@ class DWARFContext {
   SectionData m_data_debug_types;
 
   const DWARFDataExtractor &
-  LoadOrGetSection(llvm::Optional<lldb::SectionType> main_section_type,
-                   llvm::Optional<lldb::SectionType> dwo_section_type,
+  LoadOrGetSection(std::optional<lldb::SectionType> main_section_type,
+                   std::optional<lldb::SectionType> dwo_section_type,
                    SectionData &data);
 
   const DWARFDataExtractor &getOrLoadCuIndexData();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index bb2cb0e136333..13c26809e5888 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -76,7 +76,7 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &data,
   dw_form_t form;
   for (i = 0; i < numAttributes; ++i) {
     form = abbrevDecl->GetFormByIndexUnchecked(i);
-    llvm::Optional<uint8_t> fixed_skip_size =
+    std::optional<uint8_t> fixed_skip_size =
         DWARFFormValue::GetFixedSize(form, cu);
     if (fixed_skip_size)
       offset += *fixed_skip_size;
@@ -449,7 +449,8 @@ size_t DWARFDebugInfoEntry::GetAttributes(DWARFUnit *cu,
                                              recurse, curr_depth + 1);
         }
       } else {
-        llvm::Optional<uint8_t> fixed_skip_size = DWARFFormValue::GetFixedSize(form, cu);
+        std::optional<uint8_t> fixed_skip_size =
+            DWARFFormValue::GetFixedSize(form, cu);
         if (fixed_skip_size)
           offset += *fixed_skip_size;
         else
@@ -548,7 +549,7 @@ uint64_t DWARFDebugInfoEntry::GetAttributeValueAsUnsigned(
   return fail_value;
 }
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 DWARFDebugInfoEntry::GetAttributeValueAsOptionalUnsigned(
     const DWARFUnit *cu, const dw_attr_t attr,
     bool check_specification_or_abstract_origin) const {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index e499e8ec4e2d3..fcfffbfd38f08 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -68,7 +68,7 @@ class DWARFDebugInfoEntry {
       const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
       bool check_specification_or_abstract_origin = false) const;
 
-  llvm::Optional<uint64_t> GetAttributeValueAsOptionalUnsigned(
+  std::optional<uint64_t> GetAttributeValueAsOptionalUnsigned(
       const DWARFUnit *cu, const dw_attr_t attr,
       bool check_specification_or_abstract_origin = false) const;
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index d5802a39bdc94..9d168c9de0e44 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -188,8 +188,8 @@ static FormSize g_form_sizes[] = {
     {1, 8},  // 0x20 DW_FORM_ref_sig8
 };
 
-llvm::Optional<uint8_t>
-DWARFFormValue::GetFixedSize(dw_form_t form, const DWARFUnit *u) {
+std::optional<uint8_t> DWARFFormValue::GetFixedSize(dw_form_t form,
+                                                    const DWARFUnit *u) {
   if (form <= DW_FORM_ref_sig8 && g_form_sizes[form].valid)
     return static_cast<uint8_t>(g_form_sizes[form].size);
   if (form == DW_FORM_addr && u)
@@ -197,7 +197,7 @@ DWARFFormValue::GetFixedSize(dw_form_t form, const DWARFUnit *u) {
   return std::nullopt;
 }
 
-llvm::Optional<uint8_t> DWARFFormValue::GetFixedSize() const {
+std::optional<uint8_t> DWARFFormValue::GetFixedSize() const {
   return GetFixedSize(m_form, m_unit);
 }
 
@@ -469,7 +469,7 @@ const char *DWARFFormValue::AsCString() const {
       m_form == DW_FORM_strx1 || m_form == DW_FORM_strx2 ||
       m_form == DW_FORM_strx3 || m_form == DW_FORM_strx4) {
 
-    llvm::Optional<uint64_t> offset =
+    std::optional<uint64_t> offset =
         m_unit->GetStringOffsetSectionItem(m_value.value.uval);
     if (!offset)
       return nullptr;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
index 675d44f836c3d..3cbfda47ff7df 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
@@ -56,9 +56,9 @@ class DWARFFormValue {
   bool ExtractValue(const lldb_private::DWARFDataExtractor &data,
                     lldb::offset_t *offset_ptr);
   const uint8_t *BlockData() const;
-  static llvm::Optional<uint8_t> GetFixedSize(dw_form_t form,
-                                              const DWARFUnit *u);
-  llvm::Optional<uint8_t> GetFixedSize() const;
+  static std::optional<uint8_t> GetFixedSize(dw_form_t form,
+                                             const DWARFUnit *u);
+  std::optional<uint8_t> GetFixedSize() const;
   DWARFDIE Reference() const;
   uint64_t Reference(dw_offset_t offset) const;
   bool Boolean() const { return m_value.value.uval != 0; }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 3bb0b18a26726..f157a030622fc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -359,7 +359,7 @@ void DWARFUnit::SetDwoStrOffsetsBase() {
   SetStrOffsetsBase(baseOffset);
 }
 
-llvm::Optional<uint64_t> DWARFUnit::GetDWOId() {
+std::optional<uint64_t> DWARFUnit::GetDWOId() {
   ExtractUnitDIENoDwoIfNeeded();
   return m_dwo_id;
 }
@@ -553,7 +553,7 @@ void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {
   m_ranges_base = ranges_base;
 }
 
-const llvm::Optional<llvm::DWARFDebugRnglistTable> &
+const std::optional<llvm::DWARFDebugRnglistTable> &
 DWARFUnit::GetRnglistTable() {
   if (GetVersion() >= 5 && !m_rnglist_table_done) {
     m_rnglist_table_done = true;
@@ -1011,7 +1011,7 @@ uint32_t DWARFUnit::GetHeaderByteSize() const {
   llvm_unreachable("invalid UnitType.");
 }
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const {
   offset_t offset = GetStrOffsetsBase() + index * 4;
   return m_dwarf.GetDWARFContext().getOrLoadStrOffsetsData().GetU32(&offset);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 087195dd06f40..a70628a3866a7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -52,7 +52,7 @@ class DWARFUnitHeader {
   uint64_t m_type_hash = 0;
   uint32_t m_type_offset = 0;
 
-  llvm::Optional<uint64_t> m_dwo_id;
+  std::optional<uint64_t> m_dwo_id;
 
   DWARFUnitHeader() = default;
 
@@ -68,7 +68,7 @@ class DWARFUnitHeader {
   }
   uint64_t GetTypeHash() const { return m_type_hash; }
   dw_offset_t GetTypeOffset() const { return m_type_offset; }
-  llvm::Optional<uint64_t> GetDWOId() const { return m_dwo_id; }
+  std::optional<uint64_t> GetDWOId() const { return m_dwo_id; }
   bool IsTypeUnit() const {
     return m_unit_type == llvm::dwarf::DW_UT_type ||
            m_unit_type == llvm::dwarf::DW_UT_split_type;
@@ -93,7 +93,7 @@ class DWARFUnit : public lldb_private::UserID {
   virtual ~DWARFUnit();
 
   bool IsDWOUnit() { return m_is_dwo; }
-  llvm::Optional<uint64_t> GetDWOId();
+  std::optional<uint64_t> GetDWOId();
 
   void ExtractUnitDIEIfNeeded();
   void ExtractUnitDIENoDwoIfNeeded();
@@ -224,7 +224,7 @@ class DWARFUnit : public lldb_private::UserID {
   uint8_t GetUnitType() const { return m_header.GetUnitType(); }
   bool IsTypeUnit() const { return m_header.IsTypeUnit(); }
 
-  llvm::Optional<uint64_t> GetStringOffsetSectionItem(uint32_t index) const;
+  std::optional<uint64_t> GetStringOffsetSectionItem(uint32_t index) const;
 
   /// Return a list of address ranges resulting from a (possibly encoded)
   /// range list starting at a given offset in the appropriate ranges section.
@@ -240,7 +240,7 @@ class DWARFUnit : public lldb_private::UserID {
   /// DW_FORM_rnglistx.
   llvm::Expected<uint64_t> GetRnglistOffset(uint32_t Index);
 
-  llvm::Optional<uint64_t> GetLoclistOffset(uint32_t Index) {
+  std::optional<uint64_t> GetLoclistOffset(uint32_t Index) {
     if (!m_loclist_table_header)
       return std::nullopt;
 
@@ -314,7 +314,7 @@ class DWARFUnit : public lldb_private::UserID {
     return &m_die_array[0];
   }
 
-  const llvm::Optional<llvm::DWARFDebugRnglistTable> &GetRnglistTable();
+  const std::optional<llvm::DWARFDebugRnglistTable> &GetRnglistTable();
 
   lldb_private::DWARFDataExtractor GetRnglistData() const;
 
@@ -342,30 +342,30 @@ class DWARFUnit : public lldb_private::UserID {
   dw_addr_t m_base_addr = 0;
   DWARFProducer m_producer = eProducerInvalid;
   llvm::VersionTuple m_producer_version;
-  llvm::Optional<uint64_t> m_language_type;
+  std::optional<uint64_t> m_language_type;
   lldb_private::LazyBool m_is_optimized = lldb_private::eLazyBoolCalculate;
-  llvm::Optional<lldb_private::FileSpec> m_comp_dir;
-  llvm::Optional<lldb_private::FileSpec> m_file_spec;
-  llvm::Optional<dw_addr_t> m_addr_base; ///< Value of DW_AT_addr_base.
+  std::optional<lldb_private::FileSpec> m_comp_dir;
+  std::optional<lldb_private::FileSpec> m_file_spec;
+  std::optional<dw_addr_t> m_addr_base;  ///< Value of DW_AT_addr_base.
   dw_addr_t m_loclists_base = 0;         ///< Value of DW_AT_loclists_base.
   dw_addr_t m_ranges_base = 0;           ///< Value of DW_AT_rnglists_base.
-  llvm::Optional<uint64_t> m_gnu_addr_base;
-  llvm::Optional<uint64_t> m_gnu_ranges_base;
+  std::optional<uint64_t> m_gnu_addr_base;
+  std::optional<uint64_t> m_gnu_ranges_base;
 
   /// Value of DW_AT_stmt_list.
   dw_offset_t m_line_table_offset = DW_INVALID_OFFSET;
 
   dw_offset_t m_str_offsets_base = 0; // Value of DW_AT_str_offsets_base.
 
-  llvm::Optional<llvm::DWARFDebugRnglistTable> m_rnglist_table;
+  std::optional<llvm::DWARFDebugRnglistTable> m_rnglist_table;
   bool m_rnglist_table_done = false;
-  llvm::Optional<llvm::DWARFListTableHeader> m_loclist_table_header;
+  std::optional<llvm::DWARFListTableHeader> m_loclist_table_header;
 
   const DIERef::Section m_section;
   bool m_is_dwo;
   bool m_has_parsed_non_skeleton_unit;
   /// Value of DW_AT_GNU_dwo_id (v4) or dwo_id from CU header (v5).
-  llvm::Optional<uint64_t> m_dwo_id;
+  std::optional<uint64_t> m_dwo_id;
   /// If we get an error when trying to load a .dwo file, save that error here.
   /// Errors include .dwo/.dwp file not found, or the .dwp/.dwp file was found
   /// but DWO ID doesn't match, etc.

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 1e458c6cc9fad..68adb3705100e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -42,7 +42,7 @@ DebugNamesDWARFIndex::GetUnits(const DebugNames &debug_names) {
   return result;
 }
 
-llvm::Optional<DIERef>
+std::optional<DIERef>
 DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
   std::optional<uint64_t> cu_offset = entry.getCUOffset();
   if (!cu_offset)
@@ -63,7 +63,7 @@ DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
 bool DebugNamesDWARFIndex::ProcessEntry(
     const DebugNames::Entry &entry,
     llvm::function_ref<bool(DWARFDIE die)> callback, llvm::StringRef name) {
-  llvm::Optional<DIERef> ref = ToDIERef(entry);
+  std::optional<DIERef> ref = ToDIERef(entry);
   if (!ref)
     return true;
   SymbolFileDWARF &dwarf = *llvm::cast<SymbolFileDWARF>(
@@ -166,7 +166,7 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
         entry.tag() != DW_TAG_class_type)
       continue;
 
-    llvm::Optional<DIERef> ref = ToDIERef(entry);
+    std::optional<DIERef> ref = ToDIERef(entry);
     if (!ref)
       continue;
 
@@ -250,7 +250,7 @@ void DebugNamesDWARFIndex::GetFunctions(
     if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine)
       continue;
 
-    if (llvm::Optional<DIERef> ref = ToDIERef(entry)) {
+    if (std::optional<DIERef> ref = ToDIERef(entry)) {
       if (!ProcessFunctionDIE(lookup_info, *ref, dwarf, parent_decl_ctx,
                               [&](DWARFDIE die) {
                                 if (!seen.insert(die.GetDIE()).second)

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index 09dcd8de69dfc..21a3d8dcc0e3e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -78,7 +78,7 @@ class DebugNamesDWARFIndex : public DWARFIndex {
   std::unique_ptr<DebugNames> m_debug_names_up;
   ManualDWARFIndex m_fallback;
 
-  llvm::Optional<DIERef> ToDIERef(const DebugNames::Entry &entry);
+  std::optional<DIERef> ToDIERef(const DebugNames::Entry &entry);
   bool ProcessEntry(const DebugNames::Entry &entry,
                     llvm::function_ref<bool(DWARFDIE die)> callback,
                     llvm::StringRef name);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 4bfa357bb4ad1..9afed8f4ff9be 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -82,7 +82,7 @@ void ManualDWARFIndex::Index() {
 
   // Keep memory down by clearing DIEs for any units if indexing
   // caused us to load the unit's DIEs.
-  std::vector<llvm::Optional<DWARFUnit::ScopedExtractDIEs>> clear_cu_dies(
+  std::vector<std::optional<DWARFUnit::ScopedExtractDIEs>> clear_cu_dies(
       units_to_index.size());
   auto parser_fn = [&](size_t cu_idx) {
     IndexUnit(*units_to_index[cu_idx], dwp_dwarf, sets[cu_idx]);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
index ba17f5eaec1de..d6cee149f4046 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -107,7 +107,7 @@ bool NameToDIE::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr,
     // No empty strings allowed in the name to DIE maps.
     if (str.empty())
       return false;
-    if (llvm::Optional<DIERef> die_ref = DIERef::Decode(data, offset_ptr))
+    if (std::optional<DIERef> die_ref = DIERef::Decode(data, offset_ptr))
       m_map.Append(ConstString(str), *die_ref);
     else
       return false;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b41e0d9476b4b..4efa2c1830db9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -189,7 +189,7 @@ static bool ParseLLVMLineTablePrologue(lldb_private::DWARFContext &context,
   return success;
 }
 
-static llvm::Optional<std::string>
+static std::optional<std::string>
 GetFileByIndex(const llvm::DWARFDebugLine::Prologue &prologue, size_t idx,
                llvm::StringRef compile_dir, FileSpec::Style style) {
   // Try to get an absolute path first.
@@ -794,7 +794,7 @@ void SymbolFileDWARF::BuildCuTranslationTable() {
   }
 }
 
-llvm::Optional<uint32_t> SymbolFileDWARF::GetDWARFUnitIndex(uint32_t cu_idx) {
+std::optional<uint32_t> SymbolFileDWARF::GetDWARFUnitIndex(uint32_t cu_idx) {
   BuildCuTranslationTable();
   if (m_lldb_cu_to_dwarf_unit.empty())
     return cu_idx;
@@ -811,7 +811,7 @@ uint32_t SymbolFileDWARF::CalculateNumCompileUnits() {
 
 CompUnitSP SymbolFileDWARF::ParseCompileUnitAtIndex(uint32_t cu_idx) {
   ASSERT_MODULE_LOCK(this);
-  if (llvm::Optional<uint32_t> dwarf_idx = GetDWARFUnitIndex(cu_idx)) {
+  if (std::optional<uint32_t> dwarf_idx = GetDWARFUnitIndex(cu_idx)) {
     if (auto *dwarf_cu = llvm::cast_or_null<DWARFCompileUnit>(
             DebugInfo().GetUnitAtIndex(*dwarf_idx)))
       return ParseCompileUnit(*dwarf_cu);
@@ -1407,7 +1407,7 @@ user_id_t SymbolFileDWARF::GetUID(DIERef ref) {
          lldb::user_id_t(ref.section() == DIERef::Section::DebugTypes) << 63;
 }
 
-llvm::Optional<SymbolFileDWARF::DecodedUID>
+std::optional<SymbolFileDWARF::DecodedUID>
 SymbolFileDWARF::DecodeUID(lldb::user_id_t uid) {
   // This method can be called without going through the symbol vendor so we
   // need to lock the module.
@@ -1432,7 +1432,7 @@ SymbolFileDWARF::DecodeUID(lldb::user_id_t uid) {
   DIERef::Section section =
       uid >> 63 ? DIERef::Section::DebugTypes : DIERef::Section::DebugInfo;
 
-  llvm::Optional<uint32_t> dwo_num;
+  std::optional<uint32_t> dwo_num;
   bool dwo_valid = uid >> 62 & 1;
   if (dwo_valid)
     dwo_num = uid >> 32 & 0x3fffffff;
@@ -1446,7 +1446,7 @@ SymbolFileDWARF::GetDIE(lldb::user_id_t uid) {
   // need to lock the module.
   std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
 
-  llvm::Optional<DecodedUID> decoded = DecodeUID(uid);
+  std::optional<DecodedUID> decoded = DecodeUID(uid);
 
   if (decoded)
     return decoded->dwarf.GetDIE(decoded->ref);
@@ -1501,8 +1501,7 @@ Type *SymbolFileDWARF::ResolveTypeUID(lldb::user_id_t type_uid) {
     return nullptr;
 }
 
-llvm::Optional<SymbolFile::ArrayInfo>
-SymbolFileDWARF::GetDynamicArrayInfoForUID(
+std::optional<SymbolFile::ArrayInfo> SymbolFileDWARF::GetDynamicArrayInfoForUID(
     lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
   std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
   if (DWARFDIE type_die = GetDIE(type_uid))
@@ -1707,16 +1706,16 @@ SymbolFileDWARF::GetDIE(const DIERef &die_ref) {
 }
 
 /// Return the DW_AT_(GNU_)dwo_id.
-static llvm::Optional<uint64_t> GetDWOId(DWARFCompileUnit &dwarf_cu,
-                         const DWARFDebugInfoEntry &cu_die) {
-  llvm::Optional<uint64_t> dwo_id =
+static std::optional<uint64_t> GetDWOId(DWARFCompileUnit &dwarf_cu,
+                                        const DWARFDebugInfoEntry &cu_die) {
+  std::optional<uint64_t> dwo_id =
       cu_die.GetAttributeValueAsOptionalUnsigned(&dwarf_cu, DW_AT_GNU_dwo_id);
   if (dwo_id)
     return dwo_id;
   return cu_die.GetAttributeValueAsOptionalUnsigned(&dwarf_cu, DW_AT_dwo_id);
 }
 
-llvm::Optional<uint64_t> SymbolFileDWARF::GetDWOId() {
+std::optional<uint64_t> SymbolFileDWARF::GetDWOId() {
   if (GetNumCompileUnits() == 1) {
     if (auto comp_unit = GetCompileUnitAtIndex(0))
       if (DWARFCompileUnit *cu = GetDWARFCompileUnit(comp_unit.get()))
@@ -1890,7 +1889,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
 
     // Verify the DWO hash.
     // FIXME: Technically "0" is a valid hash.
-    llvm::Optional<uint64_t> dwo_id = ::GetDWOId(*dwarf_cu, *die.GetDIE());
+    std::optional<uint64_t> dwo_id = ::GetDWOId(*dwarf_cu, *die.GetDIE());
     if (!dwo_id)
       continue;
 
@@ -1898,7 +1897,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
         llvm::dyn_cast_or_null<SymbolFileDWARF>(module_sp->GetSymbolFile());
     if (!dwo_symfile)
       continue;
-    llvm::Optional<uint64_t> dwo_dwo_id = dwo_symfile->GetDWOId();
+    std::optional<uint64_t> dwo_dwo_id = dwo_symfile->GetDWOId();
     if (!dwo_dwo_id)
       continue;
 
@@ -3902,8 +3901,8 @@ CollectCallSiteParameters(ModuleSP module, DWARFDIE call_site_die) {
         child.Tag() != DW_TAG_GNU_call_site_parameter)
       continue;
 
-    llvm::Optional<DWARFExpressionList> LocationInCallee;
-    llvm::Optional<DWARFExpressionList> LocationInCaller;
+    std::optional<DWARFExpressionList> LocationInCallee;
+    std::optional<DWARFExpressionList> LocationInCaller;
 
     DWARFAttributes attributes;
     const size_t num_attributes = child.GetAttributes(attributes);
@@ -3911,7 +3910,7 @@ CollectCallSiteParameters(ModuleSP module, DWARFDIE call_site_die) {
     // Parse the location at index \p attr_index within this call site parameter
     // DIE, or return std::nullopt on failure.
     auto parse_simple_location =
-        [&](int attr_index) -> llvm::Optional<DWARFExpressionList> {
+        [&](int attr_index) -> std::optional<DWARFExpressionList> {
       DWARFFormValue form_value;
       if (!attributes.ExtractFormValueAtIndex(attr_index, form_value))
         return {};
@@ -3966,8 +3965,8 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) {
     if (child.Tag() != DW_TAG_call_site && child.Tag() != DW_TAG_GNU_call_site)
       continue;
 
-    llvm::Optional<DWARFDIE> call_origin;
-    llvm::Optional<DWARFExpressionList> call_target;
+    std::optional<DWARFDIE> call_origin;
+    std::optional<DWARFExpressionList> call_target;
     addr_t return_pc = LLDB_INVALID_ADDRESS;
     addr_t call_inst_pc = LLDB_INVALID_ADDRESS;
     addr_t low_pc = LLDB_INVALID_ADDRESS;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index f31f37e00af68..f4dd9dffdb30d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -139,7 +139,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
   ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
 
   lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override;
 
@@ -269,7 +269,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
     return GetUID(die.GetDIERef());
   }
 
-  lldb::user_id_t GetUID(const llvm::Optional<DIERef> &ref) {
+  lldb::user_id_t GetUID(const std::optional<DIERef> &ref) {
     return ref ? GetUID(*ref) : LLDB_INVALID_UID;
   }
 
@@ -279,10 +279,10 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
   GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu,
                                  const DWARFDebugInfoEntry &cu_die);
 
-  virtual llvm::Optional<uint32_t> GetDwoNum() { return std::nullopt; }
+  virtual std::optional<uint32_t> GetDwoNum() { return std::nullopt; }
 
   /// If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
-  llvm::Optional<uint64_t> GetDWOId();
+  std::optional<uint64_t> GetDWOId();
 
   static bool
   DIEInDeclContext(const lldb_private::CompilerDeclContext &parent_decl_ctx,
@@ -519,13 +519,13 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
   }
 
   void BuildCuTranslationTable();
-  llvm::Optional<uint32_t> GetDWARFUnitIndex(uint32_t cu_idx);
+  std::optional<uint32_t> GetDWARFUnitIndex(uint32_t cu_idx);
 
   struct DecodedUID {
     SymbolFileDWARF &dwarf;
     DIERef ref;
   };
-  llvm::Optional<DecodedUID> DecodeUID(lldb::user_id_t uid);
+  std::optional<DecodedUID> DecodeUID(lldb::user_id_t uid);
 
   void FindDwpSymbolFile();
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 214303b512038..11cc0a2a06f68 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -778,7 +778,7 @@ Type *SymbolFileDWARFDebugMap::ResolveTypeUID(lldb::user_id_t type_uid) {
   return nullptr;
 }
 
-llvm::Optional<SymbolFile::ArrayInfo>
+std::optional<SymbolFile::ArrayInfo>
 SymbolFileDWARFDebugMap::GetDynamicArrayInfoForUID(
     lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
   const uint64_t oso_idx = GetOSOIndexFromUserID(type_uid);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 2fe2294b4ddf4..5b364e423a6ad 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -84,7 +84,7 @@ class SymbolFileDWARFDebugMap : public lldb_private::SymbolFileCommon {
   ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
 
   lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override;
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index d52485d13a9ea..6aa56dadc0939 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -50,7 +50,7 @@ DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) {
   DWARFCompileUnit *cu = FindSingleCompileUnit();
   if (!cu)
     return nullptr;
-  llvm::Optional<uint64_t> dwo_id = cu->GetDWOId();
+  std::optional<uint64_t> dwo_id = cu->GetDWOId();
   if (!dwo_id || hash != *dwo_id)
     return nullptr;
   return cu;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 5af4a030ba21c..3edf004d683ed 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -41,7 +41,7 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
   DWARFDIE
   GetDIE(const DIERef &die_ref) override;
 
-  llvm::Optional<uint32_t> GetDwoNum() override { return GetID() >> 32; }
+  std::optional<uint32_t> GetDwoNum() override { return GetID() >> 32; }
 
   lldb::offset_t
   GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data,

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
index 7a6e1dd8a7705..ef9110b3df3cf 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
@@ -63,10 +63,10 @@ struct CompilandIndexItem {
   std::map<lldb::addr_t, PdbSymUid> m_symbols_by_va;
 
   // S_COMPILE3 sym describing compilation settings for the module.
-  llvm::Optional<llvm::codeview::Compile3Sym> m_compile_opts;
+  std::optional<llvm::codeview::Compile3Sym> m_compile_opts;
 
   // S_OBJNAME sym describing object name.
-  llvm::Optional<llvm::codeview::ObjNameSym> m_obj_name;
+  std::optional<llvm::codeview::ObjNameSym> m_obj_name;
 
   // LF_BUILDINFO sym describing source file name, working directory,
   // command line, etc.  This usually contains exactly 5 items which

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
index ed260dd368412..a5bf04c2e1212 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
@@ -131,7 +131,7 @@ static DWARFExpression MakeLocationExpressionInternal(lldb::ModuleSP module,
 
 static bool MakeRegisterBasedLocationExpressionInternal(
     Stream &stream, llvm::codeview::RegisterId reg, RegisterKind &register_kind,
-    llvm::Optional<int32_t> relative_offset, lldb::ModuleSP module) {
+    std::optional<int32_t> relative_offset, lldb::ModuleSP module) {
   uint32_t reg_num = GetRegisterNumber(module->GetArchitecture().GetMachine(),
                                        reg, register_kind);
   if (reg_num == LLDB_INVALID_REGNUM)
@@ -155,7 +155,7 @@ static bool MakeRegisterBasedLocationExpressionInternal(
 }
 
 static DWARFExpression MakeRegisterBasedLocationExpressionInternal(
-    llvm::codeview::RegisterId reg, llvm::Optional<int32_t> relative_offset,
+    llvm::codeview::RegisterId reg, std::optional<int32_t> relative_offset,
     lldb::ModuleSP module) {
   return MakeLocationExpressionInternal(
       module, [&](Stream &stream, RegisterKind &register_kind) -> bool {
@@ -275,9 +275,9 @@ lldb_private::npdb::MakeEnregisteredLocationExpressionForComposite(
             cur_offset = offset_loc.first;
           }
           MemberValLocation loc = offset_loc.second;
-          llvm::Optional<int32_t> offset =
+          std::optional<int32_t> offset =
               loc.is_at_reg ? std::nullopt
-                            : llvm::Optional<int32_t>(loc.reg_offset);
+                            : std::optional<int32_t>(loc.reg_offset);
           if (!MakeRegisterBasedLocationExpressionInternal(
                   stream, (RegisterId)loc.reg_id, register_kind, offset,
                   module))

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 14c1e73dafea0..0073db939a3eb 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -129,7 +129,7 @@ AnyScopesHaveTemplateParams(llvm::ArrayRef<llvm::ms_demangle::Node *> scopes) {
   return false;
 }
 
-static llvm::Optional<clang::CallingConv>
+static std::optional<clang::CallingConv>
 TranslateCallingConvention(llvm::codeview::CallingConvention conv) {
   using CC = llvm::codeview::CallingConvention;
   switch (conv) {
@@ -193,7 +193,7 @@ PdbAstBuilder::CreateDeclInfoForType(const TagRecord &record, TypeIndex ti) {
   // If this type doesn't have a parent type in the debug info, then the best we
   // can do is to say that it's either a series of namespaces (if the scope is
   // non-empty), or the translation unit (if the scope is empty).
-  llvm::Optional<TypeIndex> parent_index = pdb->GetParentType(ti);
+  std::optional<TypeIndex> parent_index = pdb->GetParentType(ti);
   if (!parent_index) {
     if (scopes.empty())
       return {context, uname};
@@ -273,7 +273,8 @@ clang::Decl *PdbAstBuilder::GetOrCreateSymbolForId(PdbCompilandSymId id) {
   }
 }
 
-llvm::Optional<CompilerDecl> PdbAstBuilder::GetOrCreateDeclForUid(PdbSymUid uid) {
+std::optional<CompilerDecl>
+PdbAstBuilder::GetOrCreateDeclForUid(PdbSymUid uid) {
   if (clang::Decl *result = TryGetDecl(uid))
     return ToCompilerDecl(*result);
 
@@ -362,7 +363,7 @@ clang::DeclContext *PdbAstBuilder::GetParentDeclContext(PdbSymUid uid) {
   PdbIndex& index = pdb->GetIndex();
   switch (uid.kind()) {
   case PdbSymUidKind::CompilandSym: {
-    llvm::Optional<PdbCompilandSymId> scope =
+    std::optional<PdbCompilandSymId> scope =
         pdb->FindSymbolScope(uid.asCompilandSym());
     if (scope)
       return GetOrCreateDeclContextForUid(*scope);
@@ -374,7 +375,7 @@ clang::DeclContext *PdbAstBuilder::GetParentDeclContext(PdbSymUid uid) {
     // It could be a namespace, class, or global.  We don't support nested
     // functions yet.  Anyway, we just need to consult the parent type map.
     PdbTypeSymId type_id = uid.asTypeSym();
-    llvm::Optional<TypeIndex> parent_index = pdb->GetParentType(type_id.index);
+    std::optional<TypeIndex> parent_index = pdb->GetParentType(type_id.index);
     if (!parent_index)
       return FromCompilerDeclContext(GetTranslationUnitDecl());
     return GetOrCreateDeclContextForUid(PdbTypeSymId(*parent_index));
@@ -1207,7 +1208,7 @@ clang::QualType PdbAstBuilder::CreateFunctionType(
   if (return_type.isNull())
     return {};
 
-  llvm::Optional<clang::CallingConv> cc =
+  std::optional<clang::CallingConv> cc =
       TranslateCallingConvention(calling_convention);
   if (!cc)
     return {};

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
index 0a814745e5db7..b7cad30c69c0c 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
@@ -57,7 +57,7 @@ class PdbAstBuilder {
 
   lldb_private::CompilerDeclContext GetTranslationUnitDecl();
 
-  llvm::Optional<lldb_private::CompilerDecl>
+  std::optional<lldb_private::CompilerDecl>
   GetOrCreateDeclForUid(PdbSymUid uid);
   clang::DeclContext *GetOrCreateDeclContextForUid(PdbSymUid uid);
   clang::DeclContext *GetParentDeclContext(PdbSymUid uid);

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
index c6f24fa62e766..ea778fc6cca67 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
@@ -73,12 +73,12 @@ lldb::addr_t PdbIndex::MakeVirtualAddress(uint16_t segment,
          static_cast<lldb::addr_t>(offset);
 }
 
-llvm::Optional<uint16_t>
-PdbIndex::GetModuleIndexForAddr(uint16_t segment, uint32_t offset) const {
+std::optional<uint16_t> PdbIndex::GetModuleIndexForAddr(uint16_t segment,
+                                                        uint32_t offset) const {
   return GetModuleIndexForVa(MakeVirtualAddress(segment, offset));
 }
 
-llvm::Optional<uint16_t> PdbIndex::GetModuleIndexForVa(lldb::addr_t va) const {
+std::optional<uint16_t> PdbIndex::GetModuleIndexForVa(lldb::addr_t va) const {
   auto iter = m_va_to_modi.find(va);
   if (iter == m_va_to_modi.end())
     return std::nullopt;
@@ -138,7 +138,7 @@ void PdbIndex::BuildAddrToSymbolMap(CompilandIndexItem &cci) {
 std::vector<SymbolAndUid> PdbIndex::FindSymbolsByVa(lldb::addr_t va) {
   std::vector<SymbolAndUid> result;
 
-  llvm::Optional<uint16_t> modi = GetModuleIndexForVa(va);
+  std::optional<uint16_t> modi = GetModuleIndexForVa(va);
   if (!modi)
     return result;
 

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
index d017d0fe46b31..57d682210a2f7 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
@@ -150,9 +150,9 @@ class PdbIndex {
   llvm::codeview::CVSymbol ReadSymbolRecord(PdbCompilandSymId cu_sym) const;
   llvm::codeview::CVSymbol ReadSymbolRecord(PdbGlobalSymId global) const;
 
-  llvm::Optional<uint16_t> GetModuleIndexForAddr(uint16_t segment,
-                                                 uint32_t offset) const;
-  llvm::Optional<uint16_t> GetModuleIndexForVa(lldb::addr_t va) const;
+  std::optional<uint16_t> GetModuleIndexForAddr(uint16_t segment,
+                                                uint32_t offset) const;
+  std::optional<uint16_t> GetModuleIndexForVa(lldb::addr_t va) const;
 };
 } // namespace npdb
 } // namespace lldb_private

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 7f51ee32903d2..73a1c81ac4b06 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -227,7 +227,7 @@ static bool IsClassRecord(TypeLeafKind kind) {
   }
 }
 
-static llvm::Optional<CVTagRecord>
+static std::optional<CVTagRecord>
 GetNestedTagDefinition(const NestedTypeRecord &Record,
                        const CVTagRecord &parent, TpiStream &tpi) {
   // An LF_NESTTYPE is essentially a nested typedef / using declaration, but it
@@ -778,7 +778,7 @@ TypeSP SymbolFileNativePDB::CreateType(PdbTypeSymId type_id, CompilerType ct) {
 TypeSP SymbolFileNativePDB::CreateAndCacheType(PdbTypeSymId type_id) {
   // If they search for a UDT which is a forward ref, try and resolve the full
   // decl and just map the forward ref uid to the full decl record.
-  llvm::Optional<PdbTypeSymId> full_decl_uid;
+  std::optional<PdbTypeSymId> full_decl_uid;
   if (IsForwardRefUdt(type_id, m_index->tpi())) {
     auto expected_full_ti =
         m_index->tpi().findFullDeclForForwardRef(type_id.index);
@@ -891,7 +891,7 @@ VariableSP SymbolFileNativePDB::CreateGlobalVariable(PdbGlobalSymId var_id) {
   }
 
   CompUnitSP comp_unit;
-  llvm::Optional<uint16_t> modi = m_index->GetModuleIndexForVa(addr);
+  std::optional<uint16_t> modi = m_index->GetModuleIndexForVa(addr);
   if (!modi) {
     return nullptr;
   }
@@ -1089,7 +1089,7 @@ uint32_t SymbolFileNativePDB::ResolveSymbolContext(
   lldb::addr_t file_addr = addr.GetFileAddress();
 
   if (NeedsResolvedCompileUnit(resolve_scope)) {
-    llvm::Optional<uint16_t> modi = m_index->GetModuleIndexForVa(file_addr);
+    std::optional<uint16_t> modi = m_index->GetModuleIndexForVa(file_addr);
     if (!modi)
       return 0;
     CompUnitSP cu_sp = GetCompileUnitAtIndex(*modi);
@@ -1432,11 +1432,11 @@ void SymbolFileNativePDB::ParseInlineSite(PdbCompilandSymId id,
   // Parse range and line info.
   uint32_t code_offset = 0;
   int32_t line_offset = 0;
-  llvm::Optional<uint32_t> code_offset_base;
-  llvm::Optional<uint32_t> code_offset_end;
-  llvm::Optional<int32_t> cur_line_offset;
-  llvm::Optional<int32_t> next_line_offset;
-  llvm::Optional<uint32_t> next_file_offset;
+  std::optional<uint32_t> code_offset_base;
+  std::optional<uint32_t> code_offset_end;
+  std::optional<int32_t> cur_line_offset;
+  std::optional<int32_t> next_line_offset;
+  std::optional<uint32_t> next_file_offset;
 
   bool is_terminal_entry = false;
   bool is_start_of_statement = true;
@@ -2106,7 +2106,7 @@ Type *SymbolFileNativePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
   return &*type_sp;
 }
 
-llvm::Optional<SymbolFile::ArrayInfo>
+std::optional<SymbolFile::ArrayInfo>
 SymbolFileNativePDB::GetDynamicArrayInfoForUID(
     lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
   return std::nullopt;
@@ -2216,7 +2216,7 @@ void SymbolFileNativePDB::BuildParentMap() {
           Record.Name = unnamed_type_name;
           ++unnamed_type_index;
         }
-        llvm::Optional<CVTagRecord> tag =
+        std::optional<CVTagRecord> tag =
             GetNestedTagDefinition(Record, parent_cvt, index.tpi());
         if (!tag)
           return llvm::ErrorSuccess();
@@ -2267,7 +2267,7 @@ void SymbolFileNativePDB::BuildParentMap() {
   }
 }
 
-llvm::Optional<PdbCompilandSymId>
+std::optional<PdbCompilandSymId>
 SymbolFileNativePDB::FindSymbolScope(PdbCompilandSymId id) {
   CVSymbol sym = m_index->ReadSymbolRecord(id);
   if (symbolOpensScope(sym.kind())) {
@@ -2320,7 +2320,7 @@ SymbolFileNativePDB::FindSymbolScope(PdbCompilandSymId id) {
   return scope_stack.back();
 }
 
-llvm::Optional<llvm::codeview::TypeIndex>
+std::optional<llvm::codeview::TypeIndex>
 SymbolFileNativePDB::GetParentType(llvm::codeview::TypeIndex ti) {
   auto parent_iter = m_parent_types.find(ti);
   if (parent_iter == m_parent_types.end())

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 1b2509526bde8..90cd5251679ee 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -116,7 +116,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
   CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override;
   CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override;
   Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override;
 
@@ -138,7 +138,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
   void FindFunctions(const RegularExpression &regex, bool include_inlines,
                      SymbolContextList &sc_list) override;
 
-  llvm::Optional<PdbCompilandSymId> FindSymbolScope(PdbCompilandSymId id);
+  std::optional<PdbCompilandSymId> FindSymbolScope(PdbCompilandSymId id);
 
   void FindTypes(ConstString name, const CompilerDeclContext &parent_decl_ctx,
                  uint32_t max_matches,
@@ -165,7 +165,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
 
   void DumpClangAST(Stream &s) override;
 
-  llvm::Optional<llvm::codeview::TypeIndex>
+  std::optional<llvm::codeview::TypeIndex>
   GetParentType(llvm::codeview::TypeIndex ti);
 
 private:

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
index e90c46ed62f3d..cf3868d077c3f 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
@@ -67,7 +67,7 @@ UdtRecordCompleter::UdtRecordCompleter(
 
 clang::QualType UdtRecordCompleter::AddBaseClassForTypeIndex(
     llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
-    llvm::Optional<uint64_t> vtable_idx) {
+    std::optional<uint64_t> vtable_idx) {
   PdbTypeSymId type_id(ti);
   clang::QualType qt = m_ast_builder.GetOrCreateType(type_id);
 

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
index 7e976436c6577..e6e91d0f2c3e4 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
@@ -128,7 +128,7 @@ class UdtRecordCompleter : public llvm::codeview::TypeVisitorCallbacks {
   Record m_record;
   clang::QualType AddBaseClassForTypeIndex(
       llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
-      llvm::Optional<uint64_t> vtable_idx = llvm::Optional<uint64_t>());
+      std::optional<uint64_t> vtable_idx = std::optional<uint64_t>());
   void AddMethod(llvm::StringRef name, llvm::codeview::TypeIndex type_idx,
                  llvm::codeview::MemberAccess access,
                  llvm::codeview::MethodOptions options,

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 756b43dab27e4..41d52100dcb0c 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -581,7 +581,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
       ast_typedef = ast_typedef.AddVolatileModifier();
 
     GetDeclarationForSymbol(type, decl);
-    llvm::Optional<uint64_t> size;
+    std::optional<uint64_t> size;
     if (type_def->getLength())
       size = type_def->getLength();
     return std::make_shared<lldb_private::Type>(
@@ -673,7 +673,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
     assert(array_type);
     uint32_t num_elements = array_type->getCount();
     uint32_t element_uid = array_type->getElementTypeId();
-    llvm::Optional<uint64_t> bytes;
+    std::optional<uint64_t> bytes;
     if (uint64_t size = array_type->getLength())
       bytes = size;
 
@@ -714,7 +714,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
     if (builtin_kind == PDB_BuiltinType::None)
       return nullptr;
 
-    llvm::Optional<uint64_t> bytes;
+    std::optional<uint64_t> bytes;
     if (uint64_t size = builtin_type->getLength())
       bytes = size;
     Encoding encoding = TranslateBuiltinEncoding(builtin_kind);

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index e0ecd22253331..c1557806e733e 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -591,7 +591,7 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
   return result.get();
 }
 
-llvm::Optional<SymbolFile::ArrayInfo> SymbolFilePDB::GetDynamicArrayInfoForUID(
+std::optional<SymbolFile::ArrayInfo> SymbolFilePDB::GetDynamicArrayInfoForUID(
     lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
   return std::nullopt;
 }

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index e1b58a20b242d..992bafd6a377f 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -84,7 +84,7 @@ class SymbolFilePDB : public lldb_private::SymbolFileCommon {
   ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
 
   lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override;
 

diff  --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 5e9552fc1d7ba..6e4c6439974e9 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -230,7 +230,7 @@ Type *SymbolFileSymtab::ResolveTypeUID(lldb::user_id_t type_uid) {
   return nullptr;
 }
 
-llvm::Optional<SymbolFile::ArrayInfo>
+std::optional<SymbolFile::ArrayInfo>
 SymbolFileSymtab::GetDynamicArrayInfoForUID(
     lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
   return std::nullopt;

diff  --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index b7f8afb012610..4cf4b5f370792 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -71,7 +71,7 @@ class SymbolFileSymtab : public lldb_private::SymbolFileCommon {
   ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
 
   lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
-  llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
+  std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
       lldb::user_id_t type_uid,
       const lldb_private::ExecutionContext *exe_ctx) override;
 

diff  --git a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
index 43eb3520999c3..6290843a89872 100644
--- a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
+++ b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
@@ -79,7 +79,7 @@ SymbolVendorWasm::CreateInstance(const lldb::ModuleSP &module_sp,
   // A Wasm module may have a custom section named "external_debug_info" whose
   // content is the absolute or relative path of the Wasm module that contains
   // debug symbols for this module.
-  llvm::Optional<FileSpec> symbol_file_spec =
+  std::optional<FileSpec> symbol_file_spec =
       obj_file->GetExternalDebugInfoFileSpec();
   if (!symbol_file_spec)
     return nullptr;

diff  --git a/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
index 571eea6a70e71..564a52eaaf824 100644
--- a/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
+++ b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
@@ -38,6 +38,6 @@ ThreadPostMortemTrace::CreateRegisterContextForFrame(StackFrame *frame) {
 
 bool ThreadPostMortemTrace::CalculateStopInfo() { return false; }
 
-const Optional<FileSpec> &ThreadPostMortemTrace::GetTraceFile() const {
+const std::optional<FileSpec> &ThreadPostMortemTrace::GetTraceFile() const {
   return m_trace_file;
 }

diff  --git a/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
index 1e1c8919ab772..39f53fe09f886 100644
--- a/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
+++ b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
@@ -31,7 +31,7 @@ class ThreadPostMortemTrace : public Thread {
   ///     The file that contains the list of instructions that were traced when
   ///     this thread was being executed.
   ThreadPostMortemTrace(Process &process, lldb::tid_t tid,
-                        const llvm::Optional<FileSpec> &trace_file)
+                        const std::optional<FileSpec> &trace_file)
       : Thread(process, tid), m_trace_file(trace_file) {}
 
   void RefreshStateAfterStop() override;
@@ -43,7 +43,7 @@ class ThreadPostMortemTrace : public Thread {
 
   /// \return
   ///   The trace file of this thread.
-  const llvm::Optional<FileSpec> &GetTraceFile() const;
+  const std::optional<FileSpec> &GetTraceFile() const;
 
 protected:
   bool CalculateStopInfo() override;
@@ -51,7 +51,7 @@ class ThreadPostMortemTrace : public Thread {
   lldb::RegisterContextSP m_thread_reg_ctx_sp;
 
 private:
-  llvm::Optional<FileSpec> m_trace_file;
+  std::optional<FileSpec> m_trace_file;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
index bf106ec372f26..eb40b5d8ffc18 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
@@ -33,7 +33,7 @@ Status CommandObjectThreadTraceStartIntelPT::CommandOptions::SetOptionValue(
 
   switch (short_option) {
   case 's': {
-    if (Optional<uint64_t> bytes =
+    if (std::optional<uint64_t> bytes =
             ParsingUtils::ParseUserFriendlySizeExpression(option_arg))
       m_ipt_trace_size = *bytes;
     else
@@ -98,7 +98,7 @@ Status CommandObjectProcessTraceStartIntelPT::CommandOptions::SetOptionValue(
 
   switch (short_option) {
   case 's': {
-    if (Optional<uint64_t> bytes =
+    if (std::optional<uint64_t> bytes =
             ParsingUtils::ParseUserFriendlySizeExpression(option_arg))
       m_ipt_trace_size = *bytes;
     else
@@ -107,7 +107,7 @@ Status CommandObjectProcessTraceStartIntelPT::CommandOptions::SetOptionValue(
     break;
   }
   case 'l': {
-    if (Optional<uint64_t> bytes =
+    if (std::optional<uint64_t> bytes =
             ParsingUtils::ParseUserFriendlySizeExpression(option_arg))
       m_process_buffer_size_limit = *bytes;
     else
@@ -171,7 +171,7 @@ bool CommandObjectProcessTraceStartIntelPT::DoExecute(
   return result.Succeeded();
 }
 
-Optional<uint64_t>
+std::optional<uint64_t>
 ParsingUtils::ParseUserFriendlySizeExpression(llvm::StringRef size_expression) {
   if (size_expression.empty()) {
     return std::nullopt;

diff  --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
index 1f94f9cae1386..254baaf3e6736 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
@@ -34,7 +34,7 @@ class CommandObjectThreadTraceStartIntelPT
 
     uint64_t m_ipt_trace_size;
     bool m_enable_tsc;
-    llvm::Optional<uint64_t> m_psb_period;
+    std::optional<uint64_t> m_psb_period;
   };
 
   CommandObjectThreadTraceStartIntelPT(TraceIntelPT &trace,
@@ -78,7 +78,7 @@ class CommandObjectProcessTraceStartIntelPT : public CommandObjectParsed {
     uint64_t m_ipt_trace_size;
     uint64_t m_process_buffer_size_limit;
     bool m_enable_tsc;
-    llvm::Optional<uint64_t> m_psb_period;
+    std::optional<uint64_t> m_psb_period;
     bool m_per_cpu_tracing;
     bool m_disable_cgroup_filtering;
   };
@@ -124,7 +124,7 @@ namespace ParsingUtils {
 /// \return
 ///   The converted number of bytes or \a std::nullopt if the expression is
 ///   invalid.
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 ParseUserFriendlySizeExpression(llvm::StringRef size_expression);
 } // namespace ParsingUtils
 

diff  --git a/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp b/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
index 4d0cabe19cca3..58cd2290a8b71 100644
--- a/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
@@ -155,7 +155,7 @@ lldb::cpu_id_t DecodedThread::GetCPUByIndex(uint64_t item_index) const {
   return it == m_cpus.begin() ? LLDB_INVALID_CPU_ID : prev(it)->second;
 }
 
-Optional<DecodedThread::TSCRange>
+std::optional<DecodedThread::TSCRange>
 DecodedThread::GetTSCRangeByIndex(uint64_t item_index) const {
   auto next_it = m_tscs.upper_bound(item_index);
   if (next_it == m_tscs.begin())
@@ -163,7 +163,7 @@ DecodedThread::GetTSCRangeByIndex(uint64_t item_index) const {
   return prev(next_it)->second;
 }
 
-Optional<DecodedThread::NanosecondsRange>
+std::optional<DecodedThread::NanosecondsRange>
 DecodedThread::GetNanosecondsRangeByIndex(uint64_t item_index) {
   auto next_it = m_nanoseconds.upper_bound(item_index);
   if (next_it == m_nanoseconds.begin())
@@ -244,7 +244,7 @@ const char *DecodedThread::GetErrorByIndex(uint64_t item_index) const {
 
 DecodedThread::DecodedThread(
     ThreadSP thread_sp,
-    const llvm::Optional<LinuxPerfZeroTscConversion> &tsc_conversion)
+    const std::optional<LinuxPerfZeroTscConversion> &tsc_conversion)
     : m_thread_sp(thread_sp), m_tsc_conversion(tsc_conversion) {}
 
 size_t DecodedThread::CalculateApproximateMemoryUsage() const {

diff  --git a/lldb/source/Plugins/Trace/intel-pt/DecodedThread.h b/lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
index 3ec60685e21fd..230baf363dc6d 100644
--- a/lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
+++ b/lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
@@ -151,7 +151,7 @@ class DecodedThread : public std::enable_shared_from_this<DecodedThread> {
 
   DecodedThread(
       lldb::ThreadSP thread_sp,
-      const llvm::Optional<LinuxPerfZeroTscConversion> &tsc_conversion);
+      const std::optional<LinuxPerfZeroTscConversion> &tsc_conversion);
 
   /// Get the total number of instruction, errors and events from the decoded
   /// trace.
@@ -190,7 +190,7 @@ class DecodedThread : public std::enable_shared_from_this<DecodedThread> {
   ///
   /// \return
   ///   The requested TSC range, or \a std::nullopt if not available.
-  llvm::Optional<DecodedThread::TSCRange>
+  std::optional<DecodedThread::TSCRange>
   GetTSCRangeByIndex(uint64_t item_index) const;
 
   /// Get a maximal range of trace items that include the given \p item_index
@@ -201,7 +201,7 @@ class DecodedThread : public std::enable_shared_from_this<DecodedThread> {
   ///
   /// \return
   ///   The requested nanoseconds range, or \a std::nullopt if not available.
-  llvm::Optional<DecodedThread::NanosecondsRange>
+  std::optional<DecodedThread::NanosecondsRange>
   GetNanosecondsRangeByIndex(uint64_t item_index);
 
   /// \return
@@ -296,7 +296,7 @@ class DecodedThread : public std::enable_shared_from_this<DecodedThread> {
   /// TSCs are sporadic and we can think of them as ranges.
   std::map<uint64_t, TSCRange> m_tscs;
   /// This is the chronologically last TSC that has been added.
-  llvm::Optional<std::map<uint64_t, TSCRange>::iterator> m_last_tsc =
+  std::optional<std::map<uint64_t, TSCRange>::iterator> m_last_tsc =
       std::nullopt;
   /// This map contains the non-interpolated nanoseconds timestamps of the
   /// decoded trace items. It maps `item index -> nanoseconds`, where `item
@@ -304,7 +304,7 @@ class DecodedThread : public std::enable_shared_from_this<DecodedThread> {
   /// We use this representation because timestamps are sporadic and we think of
   /// them as ranges.
   std::map<uint64_t, NanosecondsRange> m_nanoseconds;
-  llvm::Optional<std::map<uint64_t, NanosecondsRange>::iterator>
+  std::optional<std::map<uint64_t, NanosecondsRange>::iterator>
       m_last_nanoseconds = std::nullopt;
 
   // The cpu information is stored as a map. It maps `item index -> CPU`.
@@ -312,13 +312,13 @@ class DecodedThread : public std::enable_shared_from_this<DecodedThread> {
   // cpu is seen.
   std::map<uint64_t, lldb::cpu_id_t> m_cpus;
   /// This is the chronologically last CPU ID.
-  llvm::Optional<uint64_t> m_last_cpu = std::nullopt;
+  std::optional<uint64_t> m_last_cpu = std::nullopt;
 
   // The PSB offsets are stored as a map. It maps `item index -> psb offset`.
   llvm::DenseMap<uint64_t, lldb::addr_t> m_psb_offsets;
 
   /// TSC -> nanos conversion utility.
-  llvm::Optional<LinuxPerfZeroTscConversion> m_tsc_conversion;
+  std::optional<LinuxPerfZeroTscConversion> m_tsc_conversion;
 
   /// Statistics of all tracing errors.
   ErrorStats m_error_stats;

diff  --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
index 4145f14ff8bdc..cdf81954eee90 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
@@ -198,7 +198,7 @@ class PSBBlockAnomalyDetector {
     }
     if (insn_added_since_last_packet_offset ==
         m_next_infinite_decoding_loop_threshold) {
-      if (Optional<uint64_t> loop_size = TryIdentifyInfiniteLoop()) {
+      if (std::optional<uint64_t> loop_size = TryIdentifyInfiniteLoop()) {
         return createStringError(
             inconvertibleErrorCode(),
             "anomalous trace: possible infinite loop detected of size %" PRIu64,
@@ -210,7 +210,7 @@ class PSBBlockAnomalyDetector {
   }
 
 private:
-  Optional<uint64_t> TryIdentifyInfiniteLoop() {
+  std::optional<uint64_t> TryIdentifyInfiniteLoop() {
     // The infinite decoding loops we'll encounter are due to sequential
     // instructions that repeat themselves due to direct jumps, therefore in a
     // cycle each individual address will only appear once. We use this
@@ -222,7 +222,7 @@ class PSBBlockAnomalyDetector {
     // position in the trace. If the given position is an instruction, that
     // position is returned. It skips non-instruction items.
     auto most_recent_insn_index =
-        [&](uint64_t item_index) -> Optional<uint64_t> {
+        [&](uint64_t item_index) -> std::optional<uint64_t> {
       while (true) {
         if (m_decoded_thread.GetItemKindByIndex(item_index) ==
             lldb::eTraceItemKindInstruction) {
@@ -235,14 +235,14 @@ class PSBBlockAnomalyDetector {
       return std::nullopt;
     };
     // Similar to most_recent_insn_index but skips the starting position.
-    auto prev_insn_index = [&](uint64_t item_index) -> Optional<uint64_t> {
+    auto prev_insn_index = [&](uint64_t item_index) -> std::optional<uint64_t> {
       if (item_index == 0)
         return std::nullopt;
       return most_recent_insn_index(item_index - 1);
     };
 
     // We first find the most recent instruction.
-    Optional<uint64_t> last_insn_index_opt =
+    std::optional<uint64_t> last_insn_index_opt =
         *prev_insn_index(m_decoded_thread.GetItemsCount());
     if (!last_insn_index_opt)
       return std::nullopt;
@@ -250,7 +250,8 @@ class PSBBlockAnomalyDetector {
 
     // We then find the most recent previous occurrence of that last
     // instruction.
-    Optional<uint64_t> last_insn_copy_index = prev_insn_index(last_insn_index);
+    std::optional<uint64_t> last_insn_copy_index =
+        prev_insn_index(last_insn_index);
     uint64_t loop_size = 1;
     while (last_insn_copy_index &&
            m_decoded_thread.GetInstructionLoadAddress(*last_insn_copy_index) !=
@@ -267,11 +268,11 @@ class PSBBlockAnomalyDetector {
     uint64_t insn_index_a = last_insn_index,
              insn_index_b = *last_insn_copy_index;
     while (loop_elements_visited < loop_size) {
-      if (Optional<uint64_t> prev = prev_insn_index(insn_index_a))
+      if (std::optional<uint64_t> prev = prev_insn_index(insn_index_a))
         insn_index_a = *prev;
       else
         return std::nullopt;
-      if (Optional<uint64_t> prev = prev_insn_index(insn_index_b))
+      if (std::optional<uint64_t> prev = prev_insn_index(insn_index_b))
         insn_index_b = *prev;
       else
         return std::nullopt;
@@ -335,9 +336,9 @@ class PSBBlockDecoder {
   ///   Maximum allowed value of TSCs decoded from this PSB block.
   ///   Any of this PSB's data occurring after this TSC will be excluded.
   PSBBlockDecoder(PtInsnDecoderUP &&decoder_up, const PSBBlock &psb_block,
-                  Optional<lldb::addr_t> next_block_ip,
+                  std::optional<lldb::addr_t> next_block_ip,
                   DecodedThread &decoded_thread, TraceIntelPT &trace_intel_pt,
-                  llvm::Optional<DecodedThread::TSC> tsc_upper_bound)
+                  std::optional<DecodedThread::TSC> tsc_upper_bound)
       : m_decoder_up(std::move(decoder_up)), m_psb_block(psb_block),
         m_next_block_ip(next_block_ip), m_decoded_thread(decoded_thread),
         m_anomaly_detector(*m_decoder_up, trace_intel_pt, decoded_thread),
@@ -369,8 +370,9 @@ class PSBBlockDecoder {
   static Expected<PSBBlockDecoder>
   Create(TraceIntelPT &trace_intel_pt, const PSBBlock &psb_block,
          ArrayRef<uint8_t> buffer, Process &process,
-         Optional<lldb::addr_t> next_block_ip, DecodedThread &decoded_thread,
-         llvm::Optional<DecodedThread::TSC> tsc_upper_bound) {
+         std::optional<lldb::addr_t> next_block_ip,
+         DecodedThread &decoded_thread,
+         std::optional<DecodedThread::TSC> tsc_upper_bound) {
     Expected<PtInsnDecoderUP> decoder_up =
         CreateInstructionDecoder(trace_intel_pt, buffer, process);
     if (!decoder_up)
@@ -550,10 +552,10 @@ class PSBBlockDecoder {
 private:
   PtInsnDecoderUP m_decoder_up;
   PSBBlock m_psb_block;
-  Optional<lldb::addr_t> m_next_block_ip;
+  std::optional<lldb::addr_t> m_next_block_ip;
   DecodedThread &m_decoded_thread;
   PSBBlockAnomalyDetector m_anomaly_detector;
-  llvm::Optional<DecodedThread::TSC> m_tsc_upper_bound;
+  std::optional<DecodedThread::TSC> m_tsc_upper_bound;
 };
 
 Error lldb_private::trace_intel_pt::DecodeSingleTraceForThread(
@@ -707,11 +709,11 @@ lldb_private::trace_intel_pt::SplitTraceIntoPSBBlock(
     assert(offset_status >= 0 &&
            "This can't fail because we were able to synchronize");
 
-    Optional<uint64_t> ip;
+    std::optional<uint64_t> ip;
     if (!(pts_ip_suppressed & decoding_status))
       ip = maybe_ip;
 
-    Optional<uint64_t> tsc;
+    std::optional<uint64_t> tsc;
     // Now we fetch the first TSC that comes after the PSB.
     while (HasEvents(decoding_status)) {
       pt_event event;
@@ -755,7 +757,7 @@ lldb_private::trace_intel_pt::SplitTraceIntoPSBBlock(
   return executions;
 }
 
-Expected<Optional<uint64_t>>
+Expected<std::optional<uint64_t>>
 lldb_private::trace_intel_pt::FindLowestTSCInTrace(TraceIntelPT &trace_intel_pt,
                                                    ArrayRef<uint8_t> buffer) {
   Expected<PtQueryDecoderUP> decoder_up =

diff  --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
index 1b75846ea8ed1..bc8a5b963d6f4 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
@@ -26,14 +26,14 @@ struct PSBBlock {
   /// starts decoding.
   uint64_t psb_offset;
   /// The timestamp associated with the PSB packet above.
-  llvm::Optional<uint64_t> tsc;
+  std::optional<uint64_t> tsc;
   /// Size in bytes of this block
   uint64_t size;
   /// The first ip for this PSB block.
   /// This is \a std::nullopt if tracing was disabled when the PSB block was
   /// emitted.  This means that eventually there's be an enablement event that
   /// will come with an ip.
-  llvm::Optional<lldb::addr_t> starting_ip;
+  std::optional<lldb::addr_t> starting_ip;
 };
 
 /// This struct represents a continuous execution of a thread in a cpu,
@@ -115,7 +115,7 @@ SplitTraceIntoPSBBlock(TraceIntelPT &trace_intel_pt,
 ///     The lowest TSC value in this trace if available, \a std::nullopt if the
 ///     trace is empty or the trace contains no timing information, or an \a
 ///     llvm::Error if it was not possible to set up the decoder.
-llvm::Expected<llvm::Optional<uint64_t>>
+llvm::Expected<std::optional<uint64_t>>
 FindLowestTSCInTrace(TraceIntelPT &trace_intel_pt,
                      llvm::ArrayRef<uint8_t> buffer);
 

diff  --git a/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
index 1a7d4635e6039..1aa2a3cc097bb 100644
--- a/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/PerfContextSwitchDecoder.cpp
@@ -192,7 +192,7 @@ ThreadContinuousExecution ThreadContinuousExecution::CreateOnlyStartExecution(
 static Error RecoverExecutionsFromConsecutiveRecords(
     cpu_id_t cpu_id, const LinuxPerfZeroTscConversion &tsc_conversion,
     const ContextSwitchRecord &current_record,
-    const Optional<ContextSwitchRecord> &prev_record,
+    const std::optional<ContextSwitchRecord> &prev_record,
     std::function<void(const ThreadContinuousExecution &execution)>
         on_new_execution) {
   if (!prev_record) {
@@ -253,7 +253,7 @@ lldb_private::trace_intel_pt::DecodePerfContextSwitchTrace(
   size_t offset = 0;
 
   auto do_decode = [&]() -> Error {
-    Optional<ContextSwitchRecord> prev_record;
+    std::optional<ContextSwitchRecord> prev_record;
     while (offset < data.size()) {
       const perf_event_header &perf_record =
           *reinterpret_cast<const perf_event_header *>(data.data() + offset);

diff  --git a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
index 2b4b9532c929e..75d74edd44a14 100644
--- a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
@@ -21,11 +21,12 @@ using namespace llvm;
 ThreadDecoder::ThreadDecoder(const ThreadSP &thread_sp, TraceIntelPT &trace)
     : m_thread_sp(thread_sp), m_trace(trace) {}
 
-Expected<Optional<uint64_t>> ThreadDecoder::FindLowestTSC() {
-  Optional<uint64_t> lowest_tsc;
+Expected<std::optional<uint64_t>> ThreadDecoder::FindLowestTSC() {
+  std::optional<uint64_t> lowest_tsc;
   Error err = m_trace.OnThreadBufferRead(
       m_thread_sp->GetID(), [&](llvm::ArrayRef<uint8_t> data) -> llvm::Error {
-        Expected<Optional<uint64_t>> tsc = FindLowestTSCInTrace(m_trace, data);
+        Expected<std::optional<uint64_t>> tsc =
+            FindLowestTSCInTrace(m_trace, data);
         if (!tsc)
           return tsc.takeError();
         lowest_tsc = *tsc;

diff  --git a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
index adf87912b6418..289915c028105 100644
--- a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
@@ -40,7 +40,7 @@ class ThreadDecoder {
   ///     The lowest TSC value in this trace if available, \a std::nullopt if
   ///     the trace is empty or the trace contains no timing information, or an
   ///     \a llvm::Error if it was not possible to set up the decoder.
-  llvm::Expected<llvm::Optional<uint64_t>> FindLowestTSC();
+  llvm::Expected<std::optional<uint64_t>> FindLowestTSC();
 
   ThreadDecoder(const ThreadDecoder &other) = delete;
   ThreadDecoder &operator=(const ThreadDecoder &other) = delete;
@@ -50,7 +50,7 @@ class ThreadDecoder {
 
   lldb::ThreadSP m_thread_sp;
   TraceIntelPT &m_trace;
-  llvm::Optional<DecodedThreadSP> m_decoded_thread;
+  std::optional<DecodedThreadSP> m_decoded_thread;
 };
 
 } // namespace trace_intel_pt

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
index 0748dd7df905c..32e0bad0d19b9 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
@@ -19,8 +19,8 @@ using namespace llvm;
 
 TraceCursorIntelPT::TraceCursorIntelPT(
     ThreadSP thread_sp, DecodedThreadSP decoded_thread_sp,
-    const Optional<LinuxPerfZeroTscConversion> &tsc_conversion,
-    Optional<uint64_t> beginning_of_time_nanos)
+    const std::optional<LinuxPerfZeroTscConversion> &tsc_conversion,
+    std::optional<uint64_t> beginning_of_time_nanos)
     : TraceCursor(thread_sp), m_decoded_thread_sp(decoded_thread_sp),
       m_tsc_conversion(tsc_conversion),
       m_beginning_of_time_nanos(beginning_of_time_nanos) {
@@ -49,7 +49,7 @@ void TraceCursorIntelPT::ClearTimingRangesIfInvalid() {
   }
 }
 
-const Optional<DecodedThread::TSCRange> &
+const std::optional<DecodedThread::TSCRange> &
 TraceCursorIntelPT::GetTSCRange() const {
   if (!m_tsc_range_calculated) {
     m_tsc_range_calculated = true;
@@ -58,7 +58,7 @@ TraceCursorIntelPT::GetTSCRange() const {
   return m_tsc_range;
 }
 
-const Optional<DecodedThread::NanosecondsRange> &
+const std::optional<DecodedThread::NanosecondsRange> &
 TraceCursorIntelPT::GetNanosecondsRange() const {
   if (!m_nanoseconds_range_calculated) {
     m_nanoseconds_range_calculated = true;
@@ -104,13 +104,13 @@ lldb::addr_t TraceCursorIntelPT::GetLoadAddress() const {
 }
 
 std::optional<uint64_t> TraceCursorIntelPT::GetHWClock() const {
-  if (const Optional<DecodedThread::TSCRange> &range = GetTSCRange())
+  if (const std::optional<DecodedThread::TSCRange> &range = GetTSCRange())
     return range->tsc;
   return std::nullopt;
 }
 
-Optional<double> TraceCursorIntelPT::GetWallClockTime() const {
-  if (const Optional<DecodedThread::NanosecondsRange> &range =
+std::optional<double> TraceCursorIntelPT::GetWallClockTime() const {
+  if (const std::optional<DecodedThread::NanosecondsRange> &range =
           GetNanosecondsRange())
     return range->GetInterpolatedTime(m_pos, *m_beginning_of_time_nanos,
                                       *m_tsc_conversion);

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
index db873b113a97f..173426faacce1 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
@@ -19,8 +19,8 @@ class TraceCursorIntelPT : public TraceCursor {
 public:
   TraceCursorIntelPT(
       lldb::ThreadSP thread_sp, DecodedThreadSP decoded_thread_sp,
-      const llvm::Optional<LinuxPerfZeroTscConversion> &tsc_conversion,
-      llvm::Optional<uint64_t> beginning_of_time_nanos);
+      const std::optional<LinuxPerfZeroTscConversion> &tsc_conversion,
+      std::optional<uint64_t> beginning_of_time_nanos);
 
   bool Seek(int64_t offset, lldb::TraceCursorSeekType origin) override;
 
@@ -36,7 +36,7 @@ class TraceCursorIntelPT : public TraceCursor {
 
   lldb::cpu_id_t GetCPU() const override;
 
-  llvm::Optional<uint64_t> GetHWClock() const override;
+  std::optional<uint64_t> GetHWClock() const override;
 
   lldb::TraceItemKind GetItemKind() const override;
 
@@ -46,9 +46,9 @@ class TraceCursorIntelPT : public TraceCursor {
 
   bool HasId(lldb::user_id_t id) const override;
 
-  llvm::Optional<double> GetWallClockTime() const override;
+  std::optional<double> GetWallClockTime() const override;
 
-  llvm::Optional<std::string> GetSyncPointMetadata() const override;
+  std::optional<std::string> GetSyncPointMetadata() const override;
 
 private:
   /// Clear the current TSC and nanoseconds ranges if after moving they are not
@@ -56,10 +56,10 @@ class TraceCursorIntelPT : public TraceCursor {
   void ClearTimingRangesIfInvalid();
 
   /// Get or calculate the TSC range that includes the current trace item.
-  const llvm::Optional<DecodedThread::TSCRange> &GetTSCRange() const;
+  const std::optional<DecodedThread::TSCRange> &GetTSCRange() const;
 
   /// Get or calculate the TSC range that includes the current trace item.
-  const llvm::Optional<DecodedThread::NanosecondsRange> &
+  const std::optional<DecodedThread::NanosecondsRange> &
   GetNanosecondsRange() const;
 
   /// Storage of the actual instructions
@@ -71,18 +71,18 @@ class TraceCursorIntelPT : public TraceCursor {
   /// \{
 
   /// TSC -> nanos conversion utility. \a std::nullopt if not available at all.
-  llvm::Optional<LinuxPerfZeroTscConversion> m_tsc_conversion;
+  std::optional<LinuxPerfZeroTscConversion> m_tsc_conversion;
   /// Lowest nanoseconds timestamp seen in any thread trace, \a std::nullopt if
   /// not available at all.
-  llvm::Optional<uint64_t> m_beginning_of_time_nanos;
+  std::optional<uint64_t> m_beginning_of_time_nanos;
   /// Range of trace items with the same TSC that includes the current trace
   /// item, \a std::nullopt if not calculated or not available.
-  llvm::Optional<DecodedThread::TSCRange> mutable m_tsc_range;
+  std::optional<DecodedThread::TSCRange> mutable m_tsc_range;
   bool mutable m_tsc_range_calculated = false;
   /// Range of trace items with the same non-interpolated timestamps in
   /// nanoseconds that includes the current trace item, \a std::nullopt if not
   /// calculated or not available.
-  llvm::Optional<DecodedThread::NanosecondsRange> mutable m_nanoseconds_range;
+  std::optional<DecodedThread::NanosecondsRange> mutable m_nanoseconds_range;
   bool mutable m_nanoseconds_range_calculated = false;
   /// \}
 };

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
index ee51f9a8b45dd..7b307a095688b 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -158,7 +158,7 @@ TraceIntelPTSP TraceIntelPT::CreateInstanceForPostmortemTrace(
     for (const ThreadPostMortemTraceSP &thread : traced_threads) {
       trace_sp->m_storage.thread_decoders.try_emplace(
           thread->GetID(), std::make_unique<ThreadDecoder>(thread, *trace_sp));
-      if (const Optional<FileSpec> &trace_file = thread->GetTraceFile()) {
+      if (const std::optional<FileSpec> &trace_file = thread->GetTraceFile()) {
         trace_sp->SetPostMortemThreadDataFile(
             thread->GetID(), IntelPTDataKinds::kIptTrace, *trace_file);
       }
@@ -190,7 +190,7 @@ Expected<DecodedThreadSP> TraceIntelPT::Decode(Thread &thread) {
   return it->second->Decode();
 }
 
-Expected<Optional<uint64_t>> TraceIntelPT::FindBeginningOfTimeNanos() {
+Expected<std::optional<uint64_t>> TraceIntelPT::FindBeginningOfTimeNanos() {
   Storage &storage = GetUpdatedStorage();
   if (storage.beginning_of_time_nanos_calculated)
     return storage.beginning_of_time_nanos;
@@ -199,10 +199,10 @@ Expected<Optional<uint64_t>> TraceIntelPT::FindBeginningOfTimeNanos() {
   if (!storage.tsc_conversion)
     return std::nullopt;
 
-  Optional<uint64_t> lowest_tsc;
+  std::optional<uint64_t> lowest_tsc;
 
   if (storage.multicpu_decoder) {
-    if (Expected<Optional<uint64_t>> tsc =
+    if (Expected<std::optional<uint64_t>> tsc =
             storage.multicpu_decoder->FindLowestTSC()) {
       lowest_tsc = *tsc;
     } else {
@@ -211,7 +211,7 @@ Expected<Optional<uint64_t>> TraceIntelPT::FindBeginningOfTimeNanos() {
   }
 
   for (auto &decoder : storage.thread_decoders) {
-    Expected<Optional<uint64_t>> tsc = decoder.second->FindLowestTSC();
+    Expected<std::optional<uint64_t>> tsc = decoder.second->FindLowestTSC();
     if (!tsc)
       return tsc.takeError();
 
@@ -229,7 +229,7 @@ Expected<Optional<uint64_t>> TraceIntelPT::FindBeginningOfTimeNanos() {
 llvm::Expected<lldb::TraceCursorSP>
 TraceIntelPT::CreateNewCursor(Thread &thread) {
   if (Expected<DecodedThreadSP> decoded_thread = Decode(thread)) {
-    if (Expected<Optional<uint64_t>> beginning_of_time =
+    if (Expected<std::optional<uint64_t>> beginning_of_time =
             FindBeginningOfTimeNanos())
       return std::make_shared<TraceCursorIntelPT>(
           thread.shared_from_this(), *decoded_thread, m_storage.tsc_conversion,
@@ -265,12 +265,12 @@ void TraceIntelPT::DumpTraceInfo(Thread &thread, Stream &s, bool verbose,
 
   DecodedThreadSP &decoded_thread_sp = *decoded_thread_sp_or_err;
 
-  Expected<Optional<uint64_t>> raw_size_or_error = GetRawTraceSize(thread);
+  Expected<std::optional<uint64_t>> raw_size_or_error = GetRawTraceSize(thread);
   if (!raw_size_or_error) {
     s.Format("  {0}\n", toString(raw_size_or_error.takeError()));
     return;
   }
-  Optional<uint64_t> raw_size = *raw_size_or_error;
+  std::optional<uint64_t> raw_size = *raw_size_or_error;
 
   s.Format("\n  Trace technology: {0}\n", GetPluginName());
 
@@ -362,7 +362,7 @@ void TraceIntelPT::DumpTraceInfoAsJson(Thread &thread, Stream &s,
     return;
   }
 
-  Expected<Optional<uint64_t>> raw_size_or_error = GetRawTraceSize(thread);
+  Expected<std::optional<uint64_t>> raw_size_or_error = GetRawTraceSize(thread);
   if (!raw_size_or_error) {
     s << "error: " << toString(raw_size_or_error.takeError()) << "\n";
     return;
@@ -387,7 +387,7 @@ void TraceIntelPT::DumpTraceInfoAsJson(Thread &thread, Stream &s,
       uint64_t mem_used = decoded_thread_sp->CalculateApproximateMemoryUsage();
       json_str.attributeObject("memoryUsage", [&] {
         json_str.attribute("totalInBytes", std::to_string(mem_used));
-        Optional<double> avg;
+        std::optional<double> avg;
         if (insn_len != 0)
           avg = double(mem_used) / insn_len;
         json_str.attribute("avgPerItemInBytes", avg);
@@ -462,7 +462,7 @@ void TraceIntelPT::DumpTraceInfoAsJson(Thread &thread, Stream &s,
   });
 }
 
-llvm::Expected<Optional<uint64_t>>
+llvm::Expected<std::optional<uint64_t>>
 TraceIntelPT::GetRawTraceSize(Thread &thread) {
   if (GetUpdatedStorage().multicpu_decoder)
     return std::nullopt; // TODO: calculate the amount of intel pt raw trace associated
@@ -544,7 +544,7 @@ Expected<pt_cpu> TraceIntelPT::GetCPUInfo() {
   return *m_cpu_info;
 }
 
-llvm::Optional<LinuxPerfZeroTscConversion>
+std::optional<LinuxPerfZeroTscConversion>
 TraceIntelPT::GetPerfZeroTscConversion() {
   return GetUpdatedStorage().tsc_conversion;
 }
@@ -607,7 +607,7 @@ bool TraceIntelPT::IsTraced(lldb::tid_t tid) {
 // documentation file. Similarly, it should match the CLI help messages of the
 // TraceIntelPTOptions.td file.
 const char *TraceIntelPT::GetStartConfigurationHelp() {
-  static Optional<std::string> message;
+  static std::optional<std::string> message;
   if (!message) {
     message.emplace(formatv(R"(Parameters:
 
@@ -641,8 +641,8 @@ const char *TraceIntelPT::GetStartConfigurationHelp() {
 
 Error TraceIntelPT::Start(uint64_t ipt_trace_size,
                           uint64_t total_buffer_size_limit, bool enable_tsc,
-                          Optional<uint64_t> psb_period, bool per_cpu_tracing,
-                          bool disable_cgroup_filtering) {
+                          std::optional<uint64_t> psb_period,
+                          bool per_cpu_tracing, bool disable_cgroup_filtering) {
   TraceIntelPTStartRequest request;
   request.ipt_trace_size = ipt_trace_size;
   request.process_buffer_size_limit = total_buffer_size_limit;
@@ -658,7 +658,7 @@ Error TraceIntelPT::Start(StructuredData::ObjectSP configuration) {
   uint64_t ipt_trace_size = kDefaultIptTraceSize;
   uint64_t process_buffer_size_limit = kDefaultProcessBufferSizeLimit;
   bool enable_tsc = kDefaultEnableTscValue;
-  Optional<uint64_t> psb_period = kDefaultPsbPeriod;
+  std::optional<uint64_t> psb_period = kDefaultPsbPeriod;
   bool per_cpu_tracing = kDefaultPerCpuTracing;
   bool disable_cgroup_filtering = kDefaultDisableCgroupFiltering;
 
@@ -684,7 +684,7 @@ Error TraceIntelPT::Start(StructuredData::ObjectSP configuration) {
 
 llvm::Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids,
                                 uint64_t ipt_trace_size, bool enable_tsc,
-                                Optional<uint64_t> psb_period) {
+                                std::optional<uint64_t> psb_period) {
   TraceIntelPTStartRequest request;
   request.ipt_trace_size = ipt_trace_size;
   request.enable_tsc = enable_tsc;
@@ -700,14 +700,14 @@ Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids,
                           StructuredData::ObjectSP configuration) {
   uint64_t ipt_trace_size = kDefaultIptTraceSize;
   bool enable_tsc = kDefaultEnableTscValue;
-  Optional<uint64_t> psb_period = kDefaultPsbPeriod;
+  std::optional<uint64_t> psb_period = kDefaultPsbPeriod;
 
   if (configuration) {
     if (StructuredData::Dictionary *dict = configuration->GetAsDictionary()) {
       llvm::StringRef ipt_trace_size_not_parsed;
       if (dict->GetValueForKeyAsString("iptTraceSize",
                                        ipt_trace_size_not_parsed)) {
-        if (Optional<uint64_t> bytes =
+        if (std::optional<uint64_t> bytes =
                 ParsingUtils::ParseUserFriendlySizeExpression(
                     ipt_trace_size_not_parsed))
           ipt_trace_size = *bytes;

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
index ec50e244b4063..20faabdce7902 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -94,7 +94,7 @@ class TraceIntelPT : public Trace {
   void DumpTraceInfo(Thread &thread, Stream &s, bool verbose,
                      bool json) override;
 
-  llvm::Expected<llvm::Optional<uint64_t>> GetRawTraceSize(Thread &thread);
+  llvm::Expected<std::optional<uint64_t>> GetRawTraceSize(Thread &thread);
 
   llvm::Error DoRefreshLiveProcessState(TraceGetStateResponse state,
                                         llvm::StringRef json_response) override;
@@ -132,7 +132,7 @@ class TraceIntelPT : public Trace {
   ///     \a llvm::Error::success if the operation was successful, or
   ///     \a llvm::Error otherwise.
   llvm::Error Start(uint64_t ipt_trace_size, uint64_t total_buffer_size_limit,
-                    bool enable_tsc, llvm::Optional<uint64_t> psb_period,
+                    bool enable_tsc, std::optional<uint64_t> psb_period,
                     bool m_per_cpu_tracing, bool disable_cgroup_filtering);
 
   /// \copydoc Trace::Start
@@ -160,7 +160,7 @@ class TraceIntelPT : public Trace {
   ///     \a llvm::Error::success if the operation was successful, or
   ///     \a llvm::Error otherwise.
   llvm::Error Start(llvm::ArrayRef<lldb::tid_t> tids, uint64_t ipt_trace_size,
-                    bool enable_tsc, llvm::Optional<uint64_t> psb_period);
+                    bool enable_tsc, std::optional<uint64_t> psb_period);
 
   /// \copydoc Trace::Start
   llvm::Error Start(llvm::ArrayRef<lldb::tid_t> tids,
@@ -175,7 +175,7 @@ class TraceIntelPT : public Trace {
   llvm::Expected<pt_cpu> GetCPUInfo();
 
   /// Get or fetch the values used to convert to and from TSCs and nanos.
-  llvm::Optional<LinuxPerfZeroTscConversion> GetPerfZeroTscConversion();
+  std::optional<LinuxPerfZeroTscConversion> GetPerfZeroTscConversion();
 
   /// \return
   ///     The timer object for this trace.
@@ -253,7 +253,7 @@ class TraceIntelPT : public Trace {
   ///     std::nullopt if all the traces were empty or no trace contained no
   ///     timing information, or an \a llvm::Error if it was not possible to set
   ///     up the decoder for some trace.
-  llvm::Expected<llvm::Optional<uint64_t>> FindBeginningOfTimeNanos();
+  llvm::Expected<std::optional<uint64_t>> FindBeginningOfTimeNanos();
 
   // Dump out trace info in JSON format
   void DumpTraceInfoAsJson(Thread &thread, Stream &s, bool verbose);
@@ -263,22 +263,22 @@ class TraceIntelPT : public Trace {
   /// This variable should only be accessed directly by constructores or live
   /// process data refreshers.
   struct Storage {
-    llvm::Optional<TraceIntelPTMultiCpuDecoder> multicpu_decoder;
+    std::optional<TraceIntelPTMultiCpuDecoder> multicpu_decoder;
     /// These decoders are used for the non-per-cpu case
     llvm::DenseMap<lldb::tid_t, std::unique_ptr<ThreadDecoder>> thread_decoders;
     /// Helper variable used to track long running operations for telemetry.
     TaskTimer task_timer;
     /// It is provided by either a trace bundle or a live process to convert TSC
     /// counters to and from nanos. It might not be available on all hosts.
-    llvm::Optional<LinuxPerfZeroTscConversion> tsc_conversion;
-    llvm::Optional<uint64_t> beginning_of_time_nanos;
+    std::optional<LinuxPerfZeroTscConversion> tsc_conversion;
+    std::optional<uint64_t> beginning_of_time_nanos;
     bool beginning_of_time_nanos_calculated = false;
   } m_storage;
 
   /// It is provided by either a trace bundle or a live process' "cpuInfo"
   /// binary data. We don't put it in the Storage because this variable doesn't
   /// change.
-  llvm::Optional<pt_cpu> m_cpu_info;
+  std::optional<pt_cpu> m_cpu_info;
 
   /// Get the storage after refreshing the data in the case of a live process.
   Storage &GetUpdatedStorage();

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
index 6219c7e441fde..e183e592986aa 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
@@ -79,7 +79,7 @@ TraceIntelPTBundleLoader::ParseThread(Process &process,
                                       const JSONThread &thread) {
   lldb::tid_t tid = static_cast<lldb::tid_t>(thread.tid);
 
-  Optional<FileSpec> trace_file;
+  std::optional<FileSpec> trace_file;
   if (thread.ipt_trace)
     trace_file = FileSpec(*thread.ipt_trace);
 

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
index a2f56631fbd7d..a09bb372bb01c 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
@@ -134,7 +134,7 @@ BuildThreadsSection(Process &process, FileSpec directory) {
 ///   an \a llvm::Error in case of failures, \a std::nullopt if the trace is not
 ///   written to disk because the trace is empty and the \p compact flag is
 ///   present, or the FileSpec of the trace file on disk.
-static Expected<Optional<FileSpec>>
+static Expected<std::optional<FileSpec>>
 WriteContextSwitchTrace(TraceIntelPT &trace_ipt, lldb::cpu_id_t cpu_id,
                         const FileSpec &cpus_dir, bool compact) {
   FileSpec output_context_switch_trace = cpus_dir;
@@ -190,7 +190,7 @@ static Expected<FileSpec> WriteIntelPTTrace(TraceIntelPT &trace_ipt,
   return output_trace;
 }
 
-static llvm::Expected<llvm::Optional<std::vector<JSONCpu>>>
+static llvm::Expected<std::optional<std::vector<JSONCpu>>>
 BuildCpusSection(TraceIntelPT &trace_ipt, FileSpec directory, bool compact) {
   if (trace_ipt.GetTracedCpus().empty())
     return std::nullopt;
@@ -203,7 +203,7 @@ BuildCpusSection(TraceIntelPT &trace_ipt, FileSpec directory, bool compact) {
   for (lldb::cpu_id_t cpu_id : trace_ipt.GetTracedCpus()) {
     JSONCpu json_cpu;
     json_cpu.id = cpu_id;
-    Expected<Optional<FileSpec>> context_switch_trace_path =
+    Expected<std::optional<FileSpec>> context_switch_trace_path =
         WriteContextSwitchTrace(trace_ipt, cpu_id, cpus_dir, compact);
     if (!context_switch_trace_path)
       return context_switch_trace_path.takeError();
@@ -365,23 +365,23 @@ Expected<FileSpec> TraceIntelPTBundleSaver::SaveToDisk(TraceIntelPT &trace_ipt,
 
   FileSystem::Instance().Resolve(directory);
 
-  Expected<Optional<std::vector<JSONCpu>>> json_cpus =
+  Expected<std::optional<std::vector<JSONCpu>>> json_cpus =
       BuildCpusSection(trace_ipt, directory, compact);
   if (!json_cpus)
     return json_cpus.takeError();
 
-  Optional<std::vector<JSONProcess>> json_processes;
-  Optional<JSONKernel> json_kernel;
+  std::optional<std::vector<JSONProcess>> json_processes;
+  std::optional<JSONKernel> json_kernel;
 
   if (trace_ipt.GetTraceMode() == TraceIntelPT::TraceMode::KernelMode) {
-    Expected<Optional<JSONKernel>> exp_json_kernel =
+    Expected<std::optional<JSONKernel>> exp_json_kernel =
         BuildKernelSection(trace_ipt, directory);
     if (!exp_json_kernel)
       return exp_json_kernel.takeError();
     else
       json_kernel = *exp_json_kernel;
   } else {
-    Expected<Optional<std::vector<JSONProcess>>> exp_json_processes =
+    Expected<std::optional<std::vector<JSONProcess>>> exp_json_processes =
         BuildProcessesSection(trace_ipt, directory);
     if (!exp_json_processes)
       return exp_json_processes.takeError();

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
index 9db7834a27483..303a1124cec44 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
@@ -20,7 +20,7 @@ namespace trace_intel_pt {
 const size_t kDefaultIptTraceSize = 4 * 1024;                  // 4KB
 const size_t kDefaultProcessBufferSizeLimit = 5 * 1024 * 1024; // 500MB
 const bool kDefaultEnableTscValue = false;
-const llvm::Optional<size_t> kDefaultPsbPeriod = std::nullopt;
+const std::optional<size_t> kDefaultPsbPeriod = std::nullopt;
 const bool kDefaultPerCpuTracing = false;
 const bool kDefaultDisableCgroupFiltering = false;
 

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
index 0ca7e151e582f..52ca694205870 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
@@ -20,7 +20,8 @@ using namespace llvm::json;
 namespace lldb_private {
 namespace trace_intel_pt {
 
-Optional<std::vector<lldb::cpu_id_t>> JSONTraceBundleDescription::GetCpuIds() {
+std::optional<std::vector<lldb::cpu_id_t>>
+JSONTraceBundleDescription::GetCpuIds() {
   if (!cpus)
     return std::nullopt;
   std::vector<lldb::cpu_id_t> cpu_ids;

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
index 3394c3d3a234d..3f6fcd2746031 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
@@ -22,19 +22,19 @@ namespace trace_intel_pt {
 
 struct JSONModule {
   std::string system_path;
-  llvm::Optional<std::string> file;
+  std::optional<std::string> file;
   JSONUINT64 load_address;
-  llvm::Optional<std::string> uuid;
+  std::optional<std::string> uuid;
 };
 
 struct JSONThread {
   uint64_t tid;
-  llvm::Optional<std::string> ipt_trace;
+  std::optional<std::string> ipt_trace;
 };
 
 struct JSONProcess {
   uint64_t pid;
-  llvm::Optional<std::string> triple;
+  std::optional<std::string> triple;
   std::vector<JSONThread> threads;
   std::vector<JSONModule> modules;
 };
@@ -46,19 +46,19 @@ struct JSONCpu {
 };
 
 struct JSONKernel {
-  llvm::Optional<JSONUINT64> load_address;
+  std::optional<JSONUINT64> load_address;
   std::string file;
 };
 
 struct JSONTraceBundleDescription {
   std::string type;
   pt_cpu cpu_info;
-  llvm::Optional<std::vector<JSONProcess>> processes;
-  llvm::Optional<std::vector<JSONCpu>> cpus;
-  llvm::Optional<LinuxPerfZeroTscConversion> tsc_perf_zero_conversion;
-  llvm::Optional<JSONKernel> kernel;
+  std::optional<std::vector<JSONProcess>> processes;
+  std::optional<std::vector<JSONCpu>> cpus;
+  std::optional<LinuxPerfZeroTscConversion> tsc_perf_zero_conversion;
+  std::optional<JSONKernel> kernel;
 
-  llvm::Optional<std::vector<lldb::cpu_id_t>> GetCpuIds();
+  std::optional<std::vector<lldb::cpu_id_t>> GetCpuIds();
 };
 
 llvm::json::Value toJSON(const JSONModule &module);

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
index 4ce7c1416067a..e2ca8b4d1db00 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
@@ -34,15 +34,15 @@ bool TraceIntelPTMultiCpuDecoder::TracesThread(lldb::tid_t tid) const {
   return m_tids.count(tid);
 }
 
-Expected<Optional<uint64_t>> TraceIntelPTMultiCpuDecoder::FindLowestTSC() {
-  Optional<uint64_t> lowest_tsc;
+Expected<std::optional<uint64_t>> TraceIntelPTMultiCpuDecoder::FindLowestTSC() {
+  std::optional<uint64_t> lowest_tsc;
   TraceIntelPTSP trace_sp = GetTrace();
 
   Error err = GetTrace()->OnAllCpusBinaryDataRead(
       IntelPTDataKinds::kIptTrace,
       [&](const DenseMap<cpu_id_t, ArrayRef<uint8_t>> &buffers) -> Error {
         for (auto &cpu_id_to_buffer : buffers) {
-          Expected<Optional<uint64_t>> tsc =
+          Expected<std::optional<uint64_t>> tsc =
               FindLowestTSCInTrace(*trace_sp, cpu_id_to_buffer.second);
           if (!tsc)
             return tsc.takeError();
@@ -115,7 +115,7 @@ TraceIntelPTMultiCpuDecoder::DoCorrelateContextSwitchesAndIntelPtTraces() {
       continuous_executions_per_thread;
   TraceIntelPTSP trace_sp = GetTrace();
 
-  Optional<LinuxPerfZeroTscConversion> conv_opt =
+  std::optional<LinuxPerfZeroTscConversion> conv_opt =
       trace_sp->GetPerfZeroTscConversion();
   if (!conv_opt)
     return createStringError(

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
index 28ae322f25178..1633cd1e80884 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
@@ -71,7 +71,7 @@ class TraceIntelPTMultiCpuDecoder {
   ///     The lowest TSC value in this trace if available, \a std::nullopt if
   ///     the trace is empty or the trace contains no timing information, or an
   ///     \a llvm::Error if it was not possible to set up the decoder.
-  llvm::Expected<llvm::Optional<uint64_t>> FindLowestTSC();
+  llvm::Expected<std::optional<uint64_t>> FindLowestTSC();
 
 private:
   /// Traverse the context switch traces and the basic intel pt continuous
@@ -93,13 +93,13 @@ class TraceIntelPTMultiCpuDecoder {
 
   std::weak_ptr<TraceIntelPT> m_trace_wp;
   std::set<lldb::tid_t> m_tids;
-  llvm::Optional<
+  std::optional<
       llvm::DenseMap<lldb::tid_t, std::vector<IntelPTThreadContinousExecution>>>
       m_continuous_executions_per_thread;
   llvm::DenseMap<lldb::tid_t, DecodedThreadSP> m_decoded_threads;
   /// This variable will not be std::nullopt if a severe error happened during
   /// the setup of the decoder and we don't want decoding to be reattempted.
-  llvm::Optional<std::string> m_setup_error;
+  std::optional<std::string> m_setup_error;
   uint64_t m_unattributed_psb_blocks = 0;
   uint64_t m_total_psb_blocks = 0;
 };

diff  --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
index 50ae1d7bdffb5..13c63f2f7e37c 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -23,10 +23,10 @@ size_t HTRBlockMetadata::GetNumInstructions() const {
   return m_num_instructions;
 }
 
-llvm::Optional<llvm::StringRef>
+std::optional<llvm::StringRef>
 HTRBlockMetadata::GetMostFrequentlyCalledFunction() const {
   size_t max_ncalls = 0;
-  llvm::Optional<llvm::StringRef> max_name;
+  std::optional<llvm::StringRef> max_name;
   for (const auto &it : m_func_calls) {
     ConstString name = it.first;
     size_t ncalls = it.second;
@@ -81,7 +81,7 @@ llvm::ArrayRef<lldb::addr_t> HTRInstructionLayer::GetInstructionTrace() const {
 }
 
 void HTRInstructionLayer::AddCallInstructionMetadata(
-    lldb::addr_t load_addr, llvm::Optional<ConstString> func_name) {
+    lldb::addr_t load_addr, std::optional<ConstString> func_name) {
   m_call_isns.emplace(load_addr, func_name);
 }
 
@@ -109,7 +109,7 @@ HTRBlockMetadata HTRInstructionLayer::GetMetadataByIndex(size_t index) const {
 
   auto func_name_it = m_call_isns.find(instruction_load_address);
   if (func_name_it != m_call_isns.end()) {
-    if (llvm::Optional<ConstString> func_name = func_name_it->second) {
+    if (std::optional<ConstString> func_name = func_name_it->second) {
       func_calls[*func_name] = 1;
     }
   }
@@ -138,13 +138,13 @@ TraceHTR::TraceHTR(Thread &thread, TraceCursor &cursor)
   /*
   Target &target = thread.GetProcess()->GetTarget();
   auto function_name_from_load_address =
-      [&](lldb::addr_t load_address) -> llvm::Optional<ConstString> {
+      [&](lldb::addr_t load_address) -> std::optional<ConstString> {
     lldb_private::Address pc_addr;
     SymbolContext sc;
     if (target.ResolveLoadAddress(load_address, pc_addr) &&
         pc_addr.CalculateSymbolContext(&sc))
       return sc.GetFunctionName()
-                 ? llvm::Optional<ConstString>(sc.GetFunctionName())
+                 ? std::optional<ConstString>(sc.GetFunctionName())
                  : std::nullopt;
     else
       return std::nullopt;
@@ -317,7 +317,7 @@ HTRBlockLayerUP lldb_private::BasicSuperBlockMerge(IHTRLayer &layer) {
     // Each super block always has the same first unit (we call this the
     // super block head) This gurantee allows us to use the super block head as
     // the unique key mapping to the super block it begins
-    llvm::Optional<size_t> superblock_head;
+    std::optional<size_t> superblock_head;
     auto construct_next_layer = [&](size_t merge_start, size_t n) -> void {
       if (!superblock_head)
         return;
@@ -441,7 +441,7 @@ llvm::json::Value lldb_private::toJSON(const TraceHTR &htr) {
 
       HTRBlockMetadata metadata = block.GetMetadata();
 
-      llvm::Optional<llvm::StringRef> most_freq_func =
+      std::optional<llvm::StringRef> most_freq_func =
           metadata.GetMostFrequentlyCalledFunction();
       std::stringstream stream;
       stream << "0x" << std::hex << metadata.GetFirstInstructionLoadAddress();

diff  --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.h b/lldb/source/Plugins/TraceExporter/common/TraceHTR.h
index bb44fcbd65cf3..58a9262370a83 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.h
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.h
@@ -59,7 +59,7 @@ class HTRBlockMetadata {
   /// \return
   ///     The name of the function that is called the most from this block or
   ///     std::nullopt if no function is called from this block.
-  llvm::Optional<llvm::StringRef> GetMostFrequentlyCalledFunction() const;
+  std::optional<llvm::StringRef> GetMostFrequentlyCalledFunction() const;
 
   /// Get the load address of the first instruction in the block.
   ///
@@ -217,7 +217,7 @@ class HTRInstructionLayer : public IHTRLayer {
   ///     The name of the function the 'call' instruction is calling if it can
   ///     be determined, None otherwise.
   void AddCallInstructionMetadata(lldb::addr_t load_addr,
-                                  llvm::Optional<ConstString> func_name);
+                                  std::optional<ConstString> func_name);
 
   /// Append the load address of an instruction to the dynamic instruction
   /// trace.
@@ -236,7 +236,7 @@ class HTRInstructionLayer : public IHTRLayer {
   // This map contains the load address of all the call instructions.
   // load address maps to the name of the function it calls (std::nullopt if
   // function name can't be determined)
-  std::unordered_map<lldb::addr_t, llvm::Optional<ConstString>> m_call_isns;
+  std::unordered_map<lldb::addr_t, std::optional<ConstString>> m_call_isns;
 };
 
 /// HTR layer composed of blocks of the trace.

diff  --git a/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h b/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
index 067683471b073..c9f02a372deda 100644
--- a/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
+++ b/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
@@ -30,7 +30,7 @@ class CommandObjectThreadTraceExportCTF : public CommandObjectParsed {
 
     llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
 
-    llvm::Optional<size_t> m_thread_index;
+    std::optional<size_t> m_thread_index;
     std::string m_file;
   };
 

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 0bcf70662487b..086e1b5396487 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1523,7 +1523,7 @@ static bool ClassTemplateAllowsToInstantiationArgs(
   // calculate the information related to parameter packs.
 
   // Contains the first pack parameter (or non if there are none).
-  llvm::Optional<NamedDecl *> pack_parameter;
+  std::optional<NamedDecl *> pack_parameter;
   // Contains the number of non-pack parameters.
   size_t non_pack_params = params.size();
   for (size_t i = 0; i < params.size(); ++i) {
@@ -1773,7 +1773,7 @@ bool TypeSystemClang::FieldIsBitfield(FieldDecl *field,
   if (field->isBitField()) {
     Expr *bit_width_expr = field->getBitWidth();
     if (bit_width_expr) {
-      if (Optional<llvm::APSInt> bit_width_apsint =
+      if (std::optional<llvm::APSInt> bit_width_apsint =
               bit_width_expr->getIntegerConstantExpr(ast)) {
         bitfield_bit_size = bit_width_apsint->getLimitedValue(UINT32_MAX);
         return true;
@@ -3714,7 +3714,7 @@ bool TypeSystemClang::SupportsLanguage(lldb::LanguageType language) {
   return TypeSystemClangSupportsLanguage(language);
 }
 
-Optional<std::string>
+std::optional<std::string>
 TypeSystemClang::GetCXXClassName(const CompilerType &type) {
   if (!type)
     return std::nullopt;
@@ -4709,7 +4709,7 @@ TypeSystemClang::GetFloatTypeSemantics(size_t byte_size) {
   return llvm::APFloatBase::Bogus();
 }
 
-Optional<uint64_t>
+std::optional<uint64_t>
 TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type,
                             ExecutionContextScope *exe_scope) {
   if (GetCompleteType(type)) {
@@ -4773,7 +4773,7 @@ TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type,
   return std::nullopt;
 }
 
-llvm::Optional<size_t>
+std::optional<size_t>
 TypeSystemClang::GetTypeBitAlign(lldb::opaque_compiler_type_t type,
                                  ExecutionContextScope *exe_scope) {
   if (GetCompleteType(type))
@@ -5338,7 +5338,7 @@ static bool ObjCDeclHasIVars(clang::ObjCInterfaceDecl *class_interface_decl,
   return false;
 }
 
-static Optional<SymbolFile::ArrayInfo>
+static std::optional<SymbolFile::ArrayInfo>
 GetDynamicArrayInfo(TypeSystemClang &ast, SymbolFile *sym_file,
                     clang::QualType qual_type,
                     const ExecutionContext *exe_ctx) {
@@ -6280,7 +6280,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
             child_byte_offset = bit_offset / 8;
             CompilerType base_class_clang_type = GetType(base_class->getType());
             child_name = base_class_clang_type.GetTypeName().AsCString("");
-            Optional<uint64_t> size =
+            std::optional<uint64_t> size =
                 base_class_clang_type.GetBitSize(get_exe_scope());
             if (!size)
               return {};
@@ -6312,7 +6312,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
           // alignment (field_type_info.second) from the AST context.
           CompilerType field_clang_type = GetType(field->getType());
           assert(field_idx < record_layout.getFieldCount());
-          Optional<uint64_t> size =
+          std::optional<uint64_t> size =
               field_clang_type.GetByteSize(get_exe_scope());
           if (!size)
             return {};
@@ -6484,7 +6484,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
 
         // We have a pointer to an simple type
         if (idx == 0 && pointee_clang_type.GetCompleteType()) {
-          if (Optional<uint64_t> size =
+          if (std::optional<uint64_t> size =
                   pointee_clang_type.GetByteSize(get_exe_scope())) {
             child_byte_size = *size;
             child_byte_offset = 0;
@@ -6507,7 +6507,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
           ::snprintf(element_name, sizeof(element_name), "[%" PRIu64 "]",
                      static_cast<uint64_t>(idx));
           child_name.assign(element_name);
-          if (Optional<uint64_t> size =
+          if (std::optional<uint64_t> size =
                   element_type.GetByteSize(get_exe_scope())) {
             child_byte_size = *size;
             child_byte_offset = (int32_t)idx * (int32_t)child_byte_size;
@@ -6526,7 +6526,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
         CompilerType element_type = GetType(array->getElementType());
         if (element_type.GetCompleteType()) {
           child_name = std::string(llvm::formatv("[{0}]", idx));
-          if (Optional<uint64_t> size =
+          if (std::optional<uint64_t> size =
                   element_type.GetByteSize(get_exe_scope())) {
             child_byte_size = *size;
             child_byte_offset = (int32_t)idx * (int32_t)child_byte_size;
@@ -6565,7 +6565,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
 
       // We have a pointer to an simple type
       if (idx == 0) {
-        if (Optional<uint64_t> size =
+        if (std::optional<uint64_t> size =
                 pointee_clang_type.GetByteSize(get_exe_scope())) {
           child_byte_size = *size;
           child_byte_offset = 0;
@@ -6603,7 +6603,7 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
 
         // We have a pointer to an simple type
         if (idx == 0) {
-          if (Optional<uint64_t> size =
+          if (std::optional<uint64_t> size =
                   pointee_clang_type.GetByteSize(get_exe_scope())) {
             child_byte_size = *size;
             child_byte_offset = 0;
@@ -7296,7 +7296,7 @@ TypeSystemClang::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
   return GetType(arg->getAsType());
 }
 
-Optional<CompilerType::IntegralTemplateArgument>
+std::optional<CompilerType::IntegralTemplateArgument>
 TypeSystemClang::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
                                              size_t idx, bool expand_pack) {
   const clang::ClassTemplateSpecializationDecl *template_decl =
@@ -9924,7 +9924,7 @@ void ScratchTypeSystemClang::Finalize() {
 
 TypeSystemClang *
 ScratchTypeSystemClang::GetForTarget(Target &target,
-                                     llvm::Optional<IsolatedASTKind> ast_kind,
+                                     std::optional<IsolatedASTKind> ast_kind,
                                      bool create_on_demand) {
   auto type_system_or_err = target.GetScratchTypeSystemForLanguage(
       lldb::eLanguageTypeC, create_on_demand);

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 2cb61574bacbd..2f30b56d8efa1 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -646,7 +646,7 @@ class TypeSystemClang : public TypeSystem {
 
   bool SupportsLanguage(lldb::LanguageType language) override;
 
-  static llvm::Optional<std::string> GetCXXClassName(const CompilerType &type);
+  static std::optional<std::string> GetCXXClassName(const CompilerType &type);
 
   // Type Completion
 
@@ -741,23 +741,22 @@ class TypeSystemClang : public TypeSystem {
 
   const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) override;
 
-  llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
-                       ExecutionContextScope *exe_scope) {
-    if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
+  std::optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
+                                      ExecutionContextScope *exe_scope) {
+    if (std::optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
       return (*bit_size + 7) / 8;
     return std::nullopt;
   }
 
-  llvm::Optional<uint64_t>
-  GetBitSize(lldb::opaque_compiler_type_t type,
-             ExecutionContextScope *exe_scope) override;
+  std::optional<uint64_t> GetBitSize(lldb::opaque_compiler_type_t type,
+                                     ExecutionContextScope *exe_scope) override;
 
   lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
                              uint64_t &count) override;
 
   lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
 
-  llvm::Optional<size_t>
+  std::optional<size_t>
   GetTypeBitAlign(lldb::opaque_compiler_type_t type,
                   ExecutionContextScope *exe_scope) override;
 
@@ -837,7 +836,7 @@ class TypeSystemClang : public TypeSystem {
                           bool expand_pack) override;
   CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
                                        size_t idx, bool expand_pack) override;
-  llvm::Optional<CompilerType::IntegralTemplateArgument>
+  std::optional<CompilerType::IntegralTemplateArgument>
   GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
                               bool expand_pack) override;
 
@@ -1165,7 +1164,7 @@ class ScratchTypeSystemClang : public TypeSystemClang {
   static const std::nullopt_t DefaultAST;
 
   /// Infers the appropriate sub-AST from Clang's LangOptions.
-  static llvm::Optional<IsolatedASTKind>
+  static std::optional<IsolatedASTKind>
   InferIsolatedASTKindFromLangOpts(const clang::LangOptions &l) {
     // If modules are activated we want the dedicated C++ module AST.
     // See IsolatedASTKind::CppModules for more info.
@@ -1185,7 +1184,7 @@ class ScratchTypeSystemClang : public TypeSystemClang {
   ///         error occurred.
   static TypeSystemClang *
   GetForTarget(Target &target,
-               llvm::Optional<IsolatedASTKind> ast_kind = DefaultAST,
+               std::optional<IsolatedASTKind> ast_kind = DefaultAST,
                bool create_on_demand = true);
 
   /// Returns the scratch TypeSystemClang for the given target. The returned

diff  --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index f7d082d92d285..546c4dc248c14 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -320,10 +320,9 @@ void CompileUnit::ResolveSymbolContext(
   // subsequent line exact matches below.
   const bool inlines = false;
   const bool exact = true;
-  const llvm::Optional<uint16_t> column =
-      src_location_spec.GetColumn()
-          ? llvm::Optional<uint16_t>(line_entry.column)
-          : std::nullopt;
+  const std::optional<uint16_t> column =
+      src_location_spec.GetColumn() ? std::optional<uint16_t>(line_entry.column)
+                                    : std::nullopt;
 
   SourceLocationSpec found_entry(line_entry.file, line_entry.line, column,
                                  inlines, exact);

diff  --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index 3baafb2da1d9c..11a7d09680d3f 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -548,7 +548,7 @@ CompilerType::GetBasicTypeFromAST(lldb::BasicType basic_type) const {
 }
 // Exploring the type
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 CompilerType::GetBitSize(ExecutionContextScope *exe_scope) const {
   if (IsValid())
     if (auto type_system_sp = GetTypeSystem())
@@ -556,14 +556,15 @@ CompilerType::GetBitSize(ExecutionContextScope *exe_scope) const {
   return {};
 }
 
-llvm::Optional<uint64_t>
+std::optional<uint64_t>
 CompilerType::GetByteSize(ExecutionContextScope *exe_scope) const {
-  if (llvm::Optional<uint64_t> bit_size = GetBitSize(exe_scope))
+  if (std::optional<uint64_t> bit_size = GetBitSize(exe_scope))
     return (*bit_size + 7) / 8;
   return {};
 }
 
-llvm::Optional<size_t> CompilerType::GetTypeBitAlign(ExecutionContextScope *exe_scope) const {
+std::optional<size_t>
+CompilerType::GetTypeBitAlign(ExecutionContextScope *exe_scope) const {
   if (IsValid())
     if (auto type_system_sp = GetTypeSystem())
       return type_system_sp->GetTypeBitAlign(m_type, exe_scope);
@@ -768,7 +769,7 @@ CompilerType CompilerType::GetTypeTemplateArgument(size_t idx,
   return CompilerType();
 }
 
-llvm::Optional<CompilerType::IntegralTemplateArgument>
+std::optional<CompilerType::IntegralTemplateArgument>
 CompilerType::GetIntegralTemplateArgument(size_t idx, bool expand_pack) const {
   if (IsValid())
     if (auto type_system_sp = GetTypeSystem())
@@ -890,7 +891,7 @@ bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
     if (encoding == lldb::eEncodingInvalid || count != 1)
       return false;
 
-    llvm::Optional<uint64_t> byte_size = GetByteSize(exe_scope);
+    std::optional<uint64_t> byte_size = GetByteSize(exe_scope);
     if (!byte_size)
       return false;
     lldb::offset_t offset = data_byte_offset;

diff  --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
index 273a5b3e20093..a7ef4993349bd 100644
--- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
@@ -168,7 +168,7 @@ bool DWARFCallFrameInfo::GetUnwindPlan(const AddressRange &range,
       module_sp->GetObjectFile() != &m_objfile)
     return false;
 
-  if (llvm::Optional<FDEEntryMap::Entry> entry = GetFirstFDEEntryInRange(range))
+  if (std::optional<FDEEntryMap::Entry> entry = GetFirstFDEEntryInRange(range))
     return FDEToUnwindPlan(entry->data, addr, unwind_plan);
   return false;
 }
@@ -195,7 +195,7 @@ bool DWARFCallFrameInfo::GetAddressRange(Address addr, AddressRange &range) {
   return true;
 }
 
-llvm::Optional<DWARFCallFrameInfo::FDEEntryMap::Entry>
+std::optional<DWARFCallFrameInfo::FDEEntryMap::Entry>
 DWARFCallFrameInfo::GetFirstFDEEntryInRange(const AddressRange &range) {
   if (!m_section_sp || m_section_sp->IsEncrypted())
     return std::nullopt;

diff  --git a/lldb/source/Symbol/PostfixExpression.cpp b/lldb/source/Symbol/PostfixExpression.cpp
index b3832aebc5249..82db345b459c8 100644
--- a/lldb/source/Symbol/PostfixExpression.cpp
+++ b/lldb/source/Symbol/PostfixExpression.cpp
@@ -21,7 +21,7 @@ using namespace lldb_private;
 using namespace lldb_private::postfix;
 using namespace lldb_private::dwarf;
 
-static llvm::Optional<BinaryOpNode::OpType>
+static std::optional<BinaryOpNode::OpType>
 GetBinaryOpType(llvm::StringRef token) {
   if (token.size() != 1)
     return std::nullopt;
@@ -36,7 +36,7 @@ GetBinaryOpType(llvm::StringRef token) {
   return std::nullopt;
 }
 
-static llvm::Optional<UnaryOpNode::OpType>
+static std::optional<UnaryOpNode::OpType>
 GetUnaryOpType(llvm::StringRef token) {
   if (token == "^")
     return UnaryOpNode::Deref;

diff  --git a/lldb/source/Symbol/SymbolFileOnDemand.cpp b/lldb/source/Symbol/SymbolFileOnDemand.cpp
index e61de20777a0e..aa3d23ccbf4d8 100644
--- a/lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ b/lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -198,7 +198,7 @@ Type *SymbolFileOnDemand::ResolveTypeUID(lldb::user_id_t type_uid) {
   return m_sym_file_impl->ResolveTypeUID(type_uid);
 }
 
-llvm::Optional<SymbolFile::ArrayInfo>
+std::optional<SymbolFile::ArrayInfo>
 SymbolFileOnDemand::GetDynamicArrayInfoForUID(
     lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
   if (!m_debug_info_enabled) {

diff  --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index bb559b95eb66f..f901c24298a30 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -142,7 +142,7 @@ Type *SymbolFileType::GetType() {
 }
 
 Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
-           llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
+           std::optional<uint64_t> byte_size, SymbolContextScope *context,
            user_id_t encoding_uid, EncodingDataType encoding_uid_type,
            const Declaration &decl, const CompilerType &compiler_type,
            ResolveState compiler_type_resolve_state, uint32_t opaque_payload)
@@ -342,7 +342,7 @@ Type *Type::GetEncodingType() {
   return m_encoding_type;
 }
 
-llvm::Optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
+std::optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
   if (m_byte_size_has_value)
     return static_cast<uint64_t>(m_byte_size);
 
@@ -358,13 +358,14 @@ llvm::Optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
   case eEncodingIsTypedefUID: {
     Type *encoding_type = GetEncodingType();
     if (encoding_type)
-      if (llvm::Optional<uint64_t> size = encoding_type->GetByteSize(exe_scope)) {
+      if (std::optional<uint64_t> size =
+              encoding_type->GetByteSize(exe_scope)) {
         m_byte_size = *size;
         m_byte_size_has_value = true;
         return static_cast<uint64_t>(m_byte_size);
       }
 
-    if (llvm::Optional<uint64_t> size =
+    if (std::optional<uint64_t> size =
             GetLayoutCompilerType().GetByteSize(exe_scope)) {
       m_byte_size = *size;
       m_byte_size_has_value = true;

diff  --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index 66f2d8b58a685..4eae2c98b12ec 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -25,7 +25,7 @@ static_assert(eNumLanguageTypes < g_num_small_bitvector_bits,
               "Languages bit vector is no longer small on 64 bit systems");
 LanguageSet::LanguageSet() : bitvector(eNumLanguageTypes, false) {}
 
-llvm::Optional<LanguageType> LanguageSet::GetSingularLanguage() {
+std::optional<LanguageType> LanguageSet::GetSingularLanguage() {
   if (bitvector.count() == 1)
     return (LanguageType)bitvector.find_first();
   return {};
@@ -137,7 +137,7 @@ CompilerType TypeSystem::GetTypeTemplateArgument(opaque_compiler_type_t type,
   return CompilerType();
 }
 
-llvm::Optional<CompilerType::IntegralTemplateArgument>
+std::optional<CompilerType::IntegralTemplateArgument>
 TypeSystem::GetIntegralTemplateArgument(opaque_compiler_type_t type, size_t idx,
                                         bool expand_pack) {
   return std::nullopt;
@@ -181,7 +181,7 @@ TypeSystem::CreateUtilityFunction(std::string text, std::string name) {
   return {};
 }
 
-llvm::Optional<llvm::json::Value> TypeSystem::ReportStatistics() {
+std::optional<llvm::json::Value> TypeSystem::ReportStatistics() {
   return std::nullopt;
 }
 
@@ -233,7 +233,7 @@ void TypeSystemMap::ForEach(
 
 llvm::Expected<lldb::TypeSystemSP> TypeSystemMap::GetTypeSystemForLanguage(
     lldb::LanguageType language,
-    llvm::Optional<CreateCallback> create_callback) {
+    std::optional<CreateCallback> create_callback) {
   std::lock_guard<std::mutex> guard(m_mutex);
   if (m_clear_in_progress)
     return llvm::make_error<llvm::StringError>(
@@ -292,7 +292,7 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language,
                                         Module *module, bool can_create) {
   if (can_create) {
     return GetTypeSystemForLanguage(
-        language, llvm::Optional<CreateCallback>([language, module]() {
+        language, std::optional<CreateCallback>([language, module]() {
           return TypeSystem::CreateInstance(language, module);
         }));
   }
@@ -304,7 +304,7 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language,
                                         Target *target, bool can_create) {
   if (can_create) {
     return GetTypeSystemForLanguage(
-        language, llvm::Optional<CreateCallback>([language, target]() {
+        language, std::optional<CreateCallback>([language, target]() {
           return TypeSystem::CreateInstance(language, target);
         }));
   }

diff  --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp
index abb241a95d99d..6e1ead9adfb0f 100644
--- a/lldb/source/Symbol/UnwindPlan.cpp
+++ b/lldb/source/Symbol/UnwindPlan.cpp
@@ -69,7 +69,7 @@ void UnwindPlan::Row::RegisterLocation::SetIsDWARFExpression(
   m_location.expr.length = len;
 }
 
-static llvm::Optional<std::pair<lldb::ByteOrder, uint32_t>>
+static std::optional<std::pair<lldb::ByteOrder, uint32_t>>
 GetByteOrderAndAddrSize(Thread *thread) {
   if (!thread)
     return std::nullopt;

diff  --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp
index 6111402a637e9..268f95f71eb47 100644
--- a/lldb/source/Symbol/UnwindTable.cpp
+++ b/lldb/source/Symbol/UnwindTable.cpp
@@ -86,8 +86,8 @@ void UnwindTable::Initialize() {
 
 UnwindTable::~UnwindTable() = default;
 
-llvm::Optional<AddressRange> UnwindTable::GetAddressRange(const Address &addr,
-                                                          SymbolContext &sc) {
+std::optional<AddressRange> UnwindTable::GetAddressRange(const Address &addr,
+                                                         SymbolContext &sc) {
   AddressRange range;
 
   // First check the unwind info from the object file plugin

diff  --git a/lldb/source/Target/MemoryTagMap.cpp b/lldb/source/Target/MemoryTagMap.cpp
index 33705b8aa4174..c5a7c85ac09ec 100644
--- a/lldb/source/Target/MemoryTagMap.cpp
+++ b/lldb/source/Target/MemoryTagMap.cpp
@@ -28,21 +28,21 @@ void MemoryTagMap::InsertTags(lldb::addr_t addr,
 
 bool MemoryTagMap::Empty() const { return m_addr_to_tag.empty(); }
 
-std::vector<llvm::Optional<lldb::addr_t>>
+std::vector<std::optional<lldb::addr_t>>
 MemoryTagMap::GetTags(lldb::addr_t addr, size_t len) const {
   // Addr and len might be unaligned
   addr = m_manager->RemoveTagBits(addr);
   MemoryTagManager::TagRange range(addr, len);
   range = m_manager->ExpandToGranule(range);
 
-  std::vector<llvm::Optional<lldb::addr_t>> tags;
+  std::vector<std::optional<lldb::addr_t>> tags;
   lldb::addr_t end_addr = range.GetRangeEnd();
   addr = range.GetRangeBase();
   bool got_valid_tags = false;
   size_t granule_size = m_manager->GetGranuleSize();
 
   for (; addr < end_addr; addr += granule_size) {
-    llvm::Optional<lldb::addr_t> tag = GetTag(addr);
+    std::optional<lldb::addr_t> tag = GetTag(addr);
     tags.push_back(tag);
     if (tag)
       got_valid_tags = true;
@@ -55,7 +55,7 @@ MemoryTagMap::GetTags(lldb::addr_t addr, size_t len) const {
   return {};
 }
 
-llvm::Optional<lldb::addr_t> MemoryTagMap::GetTag(lldb::addr_t addr) const {
+std::optional<lldb::addr_t> MemoryTagMap::GetTag(lldb::addr_t addr) const {
   // Here we assume that addr is granule aligned, just like when the tags
   // were inserted.
   auto found = m_addr_to_tag.find(addr);

diff  --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp
index e74f858a8ed3d..13bb50b362c6f 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -165,7 +165,7 @@ void PathMappingList::Clear(bool notify) {
 
 bool PathMappingList::RemapPath(ConstString path,
                                 ConstString &new_path) const {
-  if (llvm::Optional<FileSpec> remapped = RemapPath(path.GetStringRef())) {
+  if (std::optional<FileSpec> remapped = RemapPath(path.GetStringRef())) {
     new_path.SetString(remapped->GetPath());
     return true;
   }
@@ -184,9 +184,8 @@ static void AppendPathComponents(FileSpec &path, llvm::StringRef components,
     path.AppendPathComponent(*component);
 }
 
-llvm::Optional<FileSpec>
-PathMappingList::RemapPath(llvm::StringRef mapping_path,
-                           bool only_if_exists) const {
+std::optional<FileSpec> PathMappingList::RemapPath(llvm::StringRef mapping_path,
+                                                   bool only_if_exists) const {
   if (m_pairs.empty() || mapping_path.empty())
     return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
@@ -221,7 +220,7 @@ PathMappingList::RemapPath(llvm::StringRef mapping_path,
   return {};
 }
 
-llvm::Optional<llvm::StringRef>
+std::optional<llvm::StringRef>
 PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const {
   std::string path = file.GetPath();
   llvm::StringRef path_ref(path);
@@ -239,7 +238,8 @@ PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const {
   return std::nullopt;
 }
 
-llvm::Optional<FileSpec> PathMappingList::FindFile(const FileSpec &orig_spec) const {
+std::optional<FileSpec>
+PathMappingList::FindFile(const FileSpec &orig_spec) const {
   // We must normalize the orig_spec again using the host's path style,
   // otherwise there will be mismatch between the host and remote platform
   // if they use 
diff erent path styles.

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 986b6937141d1..ed2f934bc6078 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -299,7 +299,7 @@ void Platform::GetStatus(Stream &strm) {
   if (!os_version.empty()) {
     strm.Format("OS Version: {0}", os_version.getAsString());
 
-    if (llvm::Optional<std::string> s = GetOSBuildString())
+    if (std::optional<std::string> s = GetOSBuildString())
       strm.Format(" ({0})", *s);
 
     strm.EOL();
@@ -328,7 +328,7 @@ void Platform::GetStatus(Stream &strm) {
   if (!specific_info.empty())
     strm.Printf("Platform-specific connection: %s\n", specific_info.c_str());
 
-  if (llvm::Optional<std::string> s = GetOSKernelDescription())
+  if (std::optional<std::string> s = GetOSKernelDescription())
     strm.Format("    Kernel: {0}\n", *s);
 }
 
@@ -374,13 +374,13 @@ llvm::VersionTuple Platform::GetOSVersion(Process *process) {
   return llvm::VersionTuple();
 }
 
-llvm::Optional<std::string> Platform::GetOSBuildString() {
+std::optional<std::string> Platform::GetOSBuildString() {
   if (IsHost())
     return HostInfo::GetOSBuildString();
   return GetRemoteOSBuildString();
 }
 
-llvm::Optional<std::string> Platform::GetOSKernelDescription() {
+std::optional<std::string> Platform::GetOSKernelDescription() {
   if (IsHost())
     return HostInfo::GetOSKernelDescription();
   return GetRemoteOSKernelDescription();

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 424d8cfd75bfa..1abe12f2a5920 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -4615,7 +4615,7 @@ GetExpressionTimeout(const EvaluateExpressionOptions &options,
     return *options.GetTimeout() - GetOneThreadExpressionTimeout(options);
 }
 
-static llvm::Optional<ExpressionResults>
+static std::optional<ExpressionResults>
 HandleStoppedEvent(lldb::tid_t thread_id, const ThreadPlanSP &thread_plan_sp,
                    RestorePlanState &restorer, const EventSP &event_sp,
                    EventSP &event_to_broadcast_sp,

diff  --git a/lldb/source/Target/RemoteAwarePlatform.cpp b/lldb/source/Target/RemoteAwarePlatform.cpp
index 9a1ceb4bf0581..0bd6c9251c858 100644
--- a/lldb/source/Target/RemoteAwarePlatform.cpp
+++ b/lldb/source/Target/RemoteAwarePlatform.cpp
@@ -306,13 +306,13 @@ bool RemoteAwarePlatform::GetRemoteOSVersion() {
   return false;
 }
 
-llvm::Optional<std::string> RemoteAwarePlatform::GetRemoteOSBuildString() {
+std::optional<std::string> RemoteAwarePlatform::GetRemoteOSBuildString() {
   if (m_remote_platform_sp)
     return m_remote_platform_sp->GetRemoteOSBuildString();
   return std::nullopt;
 }
 
-llvm::Optional<std::string> RemoteAwarePlatform::GetRemoteOSKernelDescription() {
+std::optional<std::string> RemoteAwarePlatform::GetRemoteOSKernelDescription() {
   if (m_remote_platform_sp)
     return m_remote_platform_sp->GetRemoteOSKernelDescription();
   return std::nullopt;

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 805bc6d1587ea..fd0cf0a5361d2 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -357,7 +357,7 @@ BreakpointSP Target::CreateBreakpoint(const FileSpecList *containingModules,
                                       bool hardware,
                                       LazyBool move_to_nearest_code) {
   FileSpec remapped_file;
-  llvm::Optional<llvm::StringRef> removed_prefix_opt =
+  std::optional<llvm::StringRef> removed_prefix_opt =
       GetSourcePathMap().ReverseRemapPath(file, remapped_file);
   if (!removed_prefix_opt)
     remapped_file = file;
@@ -4475,7 +4475,7 @@ void TargetProperties::CheckJITObjectsDir() {
   else if (!writable)
     os << "is not writable";
 
-  llvm::Optional<lldb::user_id_t> debugger_id;
+  std::optional<lldb::user_id_t> debugger_id;
   if (m_target)
     debugger_id = m_target->GetDebugger().GetID();
   Debugger::ReportError(os.str(), debugger_id);

diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index c5f5fef076100..d620f746339e7 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -2047,7 +2047,7 @@ lldb::ValueObjectSP Thread::GetSiginfoValue() {
   if (!type.IsValid())
     return ValueObjectConstResult::Create(&target, Status("no siginfo_t for the platform"));
 
-  llvm::Optional<uint64_t> type_size = type.GetByteSize(nullptr);
+  std::optional<uint64_t> type_size = type.GetByteSize(nullptr);
   assert(type_size);
   llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> data =
       GetSiginfo(*type_size);

diff  --git a/lldb/source/Target/Trace.cpp b/lldb/source/Target/Trace.cpp
index 9db1ef0be48cb..1ffd617a80fc7 100644
--- a/lldb/source/Target/Trace.cpp
+++ b/lldb/source/Target/Trace.cpp
@@ -50,7 +50,7 @@ bool fromJSON(const Value &value, JSONSimpleTraceBundleDescription &bundle,
 /// limitations in move constructors.
 /// \{
 template <typename K, typename V>
-static Optional<V> Lookup(DenseMap<K, V> &map, K k) {
+static std::optional<V> Lookup(DenseMap<K, V> &map, K k) {
   auto it = map.find(k);
   if (it == map.end())
     return std::nullopt;
@@ -67,7 +67,8 @@ static V *LookupAsPtr(DenseMap<K, V> &map, K k) {
 
 /// Similar to the methods above but it looks for an item in a map of maps.
 template <typename K1, typename K2, typename V>
-static Optional<V> Lookup(DenseMap<K1, DenseMap<K2, V>> &map, K1 k1, K2 k2) {
+static std::optional<V> Lookup(DenseMap<K1, DenseMap<K2, V>> &map, K1 k1,
+                               K2 k2) {
   auto it = map.find(k1);
   if (it == map.end())
     return std::nullopt;
@@ -183,19 +184,20 @@ Expected<std::string> Trace::GetLiveProcessState() {
   return m_live_process->TraceGetState(GetPluginName());
 }
 
-Optional<uint64_t> Trace::GetLiveThreadBinaryDataSize(lldb::tid_t tid,
-                                                      llvm::StringRef kind) {
+std::optional<uint64_t>
+Trace::GetLiveThreadBinaryDataSize(lldb::tid_t tid, llvm::StringRef kind) {
   Storage &storage = GetUpdatedStorage();
   return Lookup(storage.live_thread_data, tid, ConstString(kind));
 }
 
-Optional<uint64_t> Trace::GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
-                                                   llvm::StringRef kind) {
+std::optional<uint64_t> Trace::GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
+                                                        llvm::StringRef kind) {
   Storage &storage = GetUpdatedStorage();
   return Lookup(storage.live_cpu_data_sizes, cpu_id, ConstString(kind));
 }
 
-Optional<uint64_t> Trace::GetLiveProcessBinaryDataSize(llvm::StringRef kind) {
+std::optional<uint64_t>
+Trace::GetLiveProcessBinaryDataSize(llvm::StringRef kind) {
   Storage &storage = GetUpdatedStorage();
   return Lookup(storage.live_process_data, ConstString(kind));
 }
@@ -229,7 +231,7 @@ Trace::GetLiveTraceBinaryData(const TraceGetBinaryDataRequest &request,
 
 Expected<std::vector<uint8_t>>
 Trace::GetLiveThreadBinaryData(lldb::tid_t tid, llvm::StringRef kind) {
-  llvm::Optional<uint64_t> size = GetLiveThreadBinaryDataSize(tid, kind);
+  std::optional<uint64_t> size = GetLiveThreadBinaryDataSize(tid, kind);
   if (!size)
     return createStringError(
         inconvertibleErrorCode(),
@@ -247,7 +249,7 @@ Trace::GetLiveCpuBinaryData(lldb::cpu_id_t cpu_id, llvm::StringRef kind) {
     return createStringError(
         inconvertibleErrorCode(),
         "Attempted to fetch live cpu data without a live process.");
-  llvm::Optional<uint64_t> size = GetLiveCpuBinaryDataSize(cpu_id, kind);
+  std::optional<uint64_t> size = GetLiveCpuBinaryDataSize(cpu_id, kind);
   if (!size)
     return createStringError(
         inconvertibleErrorCode(),
@@ -261,7 +263,7 @@ Trace::GetLiveCpuBinaryData(lldb::cpu_id_t cpu_id, llvm::StringRef kind) {
 
 Expected<std::vector<uint8_t>>
 Trace::GetLiveProcessBinaryData(llvm::StringRef kind) {
-  llvm::Optional<uint64_t> size = GetLiveProcessBinaryDataSize(kind);
+  std::optional<uint64_t> size = GetLiveProcessBinaryDataSize(kind);
   if (!size)
     return createStringError(
         inconvertibleErrorCode(),
@@ -346,7 +348,7 @@ const char *Trace::RefreshLiveProcessState() {
 }
 
 Trace::Trace(ArrayRef<ProcessSP> postmortem_processes,
-             Optional<std::vector<lldb::cpu_id_t>> postmortem_cpus) {
+             std::optional<std::vector<lldb::cpu_id_t>> postmortem_cpus) {
   for (ProcessSP process_sp : postmortem_processes)
     m_storage.postmortem_processes.push_back(process_sp.get());
   m_storage.cpus = postmortem_cpus;
@@ -372,7 +374,7 @@ uint32_t Trace::GetStopID() {
 llvm::Expected<FileSpec>
 Trace::GetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind) {
   Storage &storage = GetUpdatedStorage();
-  if (Optional<FileSpec> file =
+  if (std::optional<FileSpec> file =
           Lookup(storage.postmortem_thread_data, tid, ConstString(kind)))
     return *file;
   else
@@ -385,7 +387,7 @@ Trace::GetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind) {
 llvm::Expected<FileSpec> Trace::GetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id,
                                                          llvm::StringRef kind) {
   Storage &storage = GetUpdatedStorage();
-  if (Optional<FileSpec> file =
+  if (std::optional<FileSpec> file =
           Lookup(storage.postmortem_cpu_data, cpu_id, ConstString(kind)))
     return *file;
   else

diff  --git a/lldb/source/Target/TraceDumper.cpp b/lldb/source/Target/TraceDumper.cpp
index ef367daa1f48a..d059d443805c5 100644
--- a/lldb/source/Target/TraceDumper.cpp
+++ b/lldb/source/Target/TraceDumper.cpp
@@ -532,11 +532,11 @@ CalculateSymbolInfo(const ExecutionContext &exe_ctx, lldb::addr_t load_address,
   return symbol_info;
 }
 
-Optional<lldb::user_id_t> TraceDumper::DumpInstructions(size_t count) {
+std::optional<lldb::user_id_t> TraceDumper::DumpInstructions(size_t count) {
   ThreadSP thread_sp = m_cursor_sp->GetExecutionContextRef().GetThreadSP();
 
   SymbolInfo prev_symbol_info;
-  Optional<lldb::user_id_t> last_id;
+  std::optional<lldb::user_id_t> last_id;
 
   ExecutionContext exe_ctx;
   thread_sp->GetProcess()->GetTarget().CalculateExecutionContext(exe_ctx);
@@ -669,7 +669,7 @@ TraceDumper::FunctionCall::GetLastTracedSegment() {
   return m_traced_segments.back();
 }
 
-const Optional<TraceDumper::FunctionCall::UntracedPrefixSegment> &
+const std::optional<TraceDumper::FunctionCall::UntracedPrefixSegment> &
 TraceDumper::FunctionCall::GetUntracedPrefixSegment() const {
   return m_untraced_prefix_segment;
 }

diff  --git a/lldb/source/Target/UnixSignals.cpp b/lldb/source/Target/UnixSignals.cpp
index 9cfc0a0cc0761..858b1691f3188 100644
--- a/lldb/source/Target/UnixSignals.cpp
+++ b/lldb/source/Target/UnixSignals.cpp
@@ -286,9 +286,9 @@ int32_t UnixSignals::GetSignalAtIndex(int32_t index) const {
 uint64_t UnixSignals::GetVersion() const { return m_version; }
 
 std::vector<int32_t>
-UnixSignals::GetFilteredSignals(llvm::Optional<bool> should_suppress,
-                                llvm::Optional<bool> should_stop,
-                                llvm::Optional<bool> should_notify) {
+UnixSignals::GetFilteredSignals(std::optional<bool> should_suppress,
+                                std::optional<bool> should_stop,
+                                std::optional<bool> should_notify) {
   std::vector<int32_t> result;
   for (int32_t signo = GetFirstSignalNumber();
        signo != LLDB_INVALID_SIGNAL_NUMBER;

diff  --git a/lldb/source/Utility/Diagnostics.cpp b/lldb/source/Utility/Diagnostics.cpp
index ff5d36a740034..a59750167cf74 100644
--- a/lldb/source/Utility/Diagnostics.cpp
+++ b/lldb/source/Utility/Diagnostics.cpp
@@ -32,8 +32,8 @@ void Diagnostics::Terminate() {
 
 bool Diagnostics::Enabled() { return InstanceImpl().operator bool(); }
 
-Optional<Diagnostics> &Diagnostics::InstanceImpl() {
-  static Optional<Diagnostics> g_diagnostics;
+std::optional<Diagnostics> &Diagnostics::InstanceImpl() {
+  static std::optional<Diagnostics> g_diagnostics;
   return g_diagnostics;
 }
 

diff  --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index d871321497949..7ff57307dec56 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -305,7 +305,8 @@ bool FileSpec::Match(const FileSpec &pattern, const FileSpec &file) {
   return true;
 }
 
-llvm::Optional<FileSpec::Style> FileSpec::GuessPathStyle(llvm::StringRef absolute_path) {
+std::optional<FileSpec::Style>
+FileSpec::GuessPathStyle(llvm::StringRef absolute_path) {
   if (absolute_path.startswith("/"))
     return Style::posix;
   if (absolute_path.startswith(R"(\\)"))

diff  --git a/lldb/source/Utility/ProcessInfo.cpp b/lldb/source/Utility/ProcessInfo.cpp
index ccde1b313a53b..8e27a17d83376 100644
--- a/lldb/source/Utility/ProcessInfo.cpp
+++ b/lldb/source/Utility/ProcessInfo.cpp
@@ -193,7 +193,7 @@ void ProcessInstanceInfo::DumpAsTableRow(Stream &s, UserIDResolver &resolver,
 
     auto print = [&](bool (ProcessInstanceInfo::*isValid)() const,
                      uint32_t (ProcessInstanceInfo::*getID)() const,
-                     llvm::Optional<llvm::StringRef> (UserIDResolver::*getName)(
+                     std::optional<llvm::StringRef> (UserIDResolver::*getName)(
                          UserIDResolver::id_t id)) {
       const char *format = "{0,-10} ";
       if (!(this->*isValid)()) {

diff  --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp
index bc83317618e35..a6032a3e8eed9 100644
--- a/lldb/source/Utility/SelectHelper.cpp
+++ b/lldb/source/Utility/SelectHelper.cpp
@@ -83,7 +83,7 @@ bool SelectHelper::FDIsSetError(lldb::socket_t fd) const {
     return false;
 }
 
-static void updateMaxFd(llvm::Optional<lldb::socket_t> &vold,
+static void updateMaxFd(std::optional<lldb::socket_t> &vold,
                         lldb::socket_t vnew) {
   if (!vold)
     vold = vnew;
@@ -101,10 +101,10 @@ lldb_private::Status SelectHelper::Select() {
     return lldb_private::Status("Too many file descriptors for select()");
 #endif
 
-  llvm::Optional<lldb::socket_t> max_read_fd;
-  llvm::Optional<lldb::socket_t> max_write_fd;
-  llvm::Optional<lldb::socket_t> max_error_fd;
-  llvm::Optional<lldb::socket_t> max_fd;
+  std::optional<lldb::socket_t> max_read_fd;
+  std::optional<lldb::socket_t> max_write_fd;
+  std::optional<lldb::socket_t> max_error_fd;
+  std::optional<lldb::socket_t> max_fd;
   for (auto &pair : m_fd_map) {
     pair.second.PrepareForSelect();
     const lldb::socket_t fd = pair.first;

diff  --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp
index 3d0913d9906e7..9f79d2271b1e6 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -638,7 +638,7 @@ bool StringExtractorGDBRemote::ValidateResponse() const {
     return true; // No validator, so response is valid
 }
 
-llvm::Optional<std::pair<lldb::pid_t, lldb::tid_t>>
+std::optional<std::pair<lldb::pid_t, lldb::tid_t>>
 StringExtractorGDBRemote::GetPidTid(lldb::pid_t default_pid) {
   llvm::StringRef view = llvm::StringRef(m_packet).substr(m_index);
   size_t initial_length = view.size();

diff  --git a/lldb/source/Utility/UriParser.cpp b/lldb/source/Utility/UriParser.cpp
index 0e32cb3dfe51e..432b046d008b9 100644
--- a/lldb/source/Utility/UriParser.cpp
+++ b/lldb/source/Utility/UriParser.cpp
@@ -25,7 +25,7 @@ llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS,
   return OS << U.path;
 }
 
-llvm::Optional<URI> URI::Parse(llvm::StringRef uri) {
+std::optional<URI> URI::Parse(llvm::StringRef uri) {
   URI ret;
 
   const llvm::StringRef kSchemeSep("://");

diff  --git a/lldb/source/Utility/UserIDResolver.cpp b/lldb/source/Utility/UserIDResolver.cpp
index 113143b64dbe7..83e033f32310b 100644
--- a/lldb/source/Utility/UserIDResolver.cpp
+++ b/lldb/source/Utility/UserIDResolver.cpp
@@ -14,9 +14,9 @@ using namespace lldb_private;
 
 UserIDResolver::~UserIDResolver() = default;
 
-llvm::Optional<llvm::StringRef> UserIDResolver::Get(
+std::optional<llvm::StringRef> UserIDResolver::Get(
     id_t id, Map &cache,
-    llvm::Optional<std::string> (UserIDResolver::*do_get)(id_t)) {
+    std::optional<std::string> (UserIDResolver::*do_get)(id_t)) {
 
   std::lock_guard<std::mutex> guard(m_mutex);
   auto iter_bool = cache.try_emplace(id, std::nullopt);
@@ -30,11 +30,11 @@ llvm::Optional<llvm::StringRef> UserIDResolver::Get(
 namespace {
 class NoopResolver : public UserIDResolver {
 protected:
-  llvm::Optional<std::string> DoGetUserName(id_t uid) override {
+  std::optional<std::string> DoGetUserName(id_t uid) override {
     return std::nullopt;
   }
 
-  llvm::Optional<std::string> DoGetGroupName(id_t gid) override {
+  std::optional<std::string> DoGetGroupName(id_t gid) override {
     return std::nullopt;
   }
 };

diff  --git a/lldb/tools/lldb-server/Acceptor.cpp b/lldb/tools/lldb-server/Acceptor.cpp
index 0b69350c1accb..2037f1e0f62b9 100644
--- a/lldb/tools/lldb-server/Acceptor.cpp
+++ b/lldb/tools/lldb-server/Acceptor.cpp
@@ -86,7 +86,7 @@ std::unique_ptr<Acceptor> Acceptor::Create(StringRef name,
 
   Socket::SocketProtocol socket_protocol = Socket::ProtocolUnixDomain;
   // Try to match socket name as URL - e.g., tcp://localhost:5555
-  if (llvm::Optional<URI> res = URI::Parse(name)) {
+  if (std::optional<URI> res = URI::Parse(name)) {
     if (!FindProtocolByScheme(res->scheme.str().c_str(), socket_protocol))
       error.SetErrorStringWithFormat("Unknown protocol scheme \"%s\"",
                                      res->scheme.str().c_str());

diff  --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index fb37aa6f61756..21b433511c565 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -353,7 +353,7 @@ int main_platform(int argc, char *argv[]) {
     if (platform.IsConnected()) {
       if (inferior_arguments.GetArgumentCount() > 0) {
         lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
-        llvm::Optional<uint16_t> port = 0;
+        std::optional<uint16_t> port = 0;
         std::string socket_name;
         Status error = platform.LaunchGDBServer(inferior_arguments,
                                                 "", // hostname

diff  --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index 6bd8585bdabe7..d9c30b4f2ed81 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -141,7 +141,7 @@ static cl::opt<std::string> InputFile(cl::Positional, cl::desc("<input file>"),
                                       cl::Required, cl::sub(SymTabSubcommand));
 
 /// Validate that the options passed make sense.
-static llvm::Optional<llvm::Error> validate();
+static std::optional<llvm::Error> validate();
 
 /// Transforms the selected mangling preference into a Mangled::NamePreference
 static Mangled::NamePreference getNamePreference();
@@ -861,7 +861,7 @@ Expected<Error (*)(lldb_private::Module &)> opts::symbols::getAction() {
   llvm_unreachable("Unsupported symbol action.");
 }
 
-llvm::Optional<llvm::Error> opts::symtab::validate() {
+std::optional<llvm::Error> opts::symtab::validate() {
   if (ManglingPreference != ManglingPreference::None &&
       FindSymbolsByRegex.empty())
     return make_string_error("Mangling preference set but no regex specified.");

diff  --git a/lldb/tools/lldb-vscode/FifoFiles.cpp b/lldb/tools/lldb-vscode/FifoFiles.cpp
index 18354bfabceac..a5330d58c36c6 100644
--- a/lldb/tools/lldb-vscode/FifoFiles.cpp
+++ b/lldb/tools/lldb-vscode/FifoFiles.cpp
@@ -53,7 +53,7 @@ FifoFileIO::FifoFileIO(StringRef fifo_file, StringRef other_endpoint_name)
 Expected<json::Value> FifoFileIO::ReadJSON(std::chrono::milliseconds timeout) {
   // We use a pointer for this future, because otherwise its normal destructor
   // would wait for the getline to end, rendering the timeout useless.
-  Optional<std::string> line;
+  std::optional<std::string> line;
   std::future<void> *future =
       new std::future<void>(std::async(std::launch::async, [&]() {
         std::ifstream reader(m_fifo_file, std::ifstream::in);

diff  --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp
index 06d5c28c2a1b1..82f591148811a 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -308,8 +308,8 @@ llvm::json::Value CreateScope(const llvm::StringRef name,
 //   "required": [ "verified" ]
 // }
 llvm::json::Value CreateBreakpoint(lldb::SBBreakpoint &bp,
-                                   llvm::Optional<llvm::StringRef> request_path,
-                                   llvm::Optional<uint32_t> request_line) {
+                                   std::optional<llvm::StringRef> request_path,
+                                   std::optional<uint32_t> request_line) {
   // Each breakpoint location is treated as a separate breakpoint for VS code.
   // They don't have the notion of a single breakpoint with multiple locations.
   llvm::json::Object object;
@@ -440,8 +440,8 @@ llvm::json::Value CreateModule(lldb::SBModule &module) {
 }
 
 void AppendBreakpoint(lldb::SBBreakpoint &bp, llvm::json::Array &breakpoints,
-                      llvm::Optional<llvm::StringRef> request_path,
-                      llvm::Optional<uint32_t> request_line) {
+                      std::optional<llvm::StringRef> request_path,
+                      std::optional<uint32_t> request_line) {
   breakpoints.emplace_back(CreateBreakpoint(bp, request_path, request_line));
 }
 

diff  --git a/lldb/tools/lldb-vscode/JSONUtils.h b/lldb/tools/lldb-vscode/JSONUtils.h
index 64c1a4c3d554c..b67da7191cde4 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.h
+++ b/lldb/tools/lldb-vscode/JSONUtils.h
@@ -211,8 +211,8 @@ void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
 ///     fallback.
 void AppendBreakpoint(
     lldb::SBBreakpoint &bp, llvm::json::Array &breakpoints,
-    llvm::Optional<llvm::StringRef> request_path = std::nullopt,
-    llvm::Optional<uint32_t> request_line = std::nullopt);
+    std::optional<llvm::StringRef> request_path = std::nullopt,
+    std::optional<uint32_t> request_line = std::nullopt);
 
 /// Converts breakpoint location to a Visual Studio Code "Breakpoint"
 ///
@@ -237,8 +237,8 @@ void AppendBreakpoint(
 ///     definition outlined by Microsoft.
 llvm::json::Value
 CreateBreakpoint(lldb::SBBreakpoint &bp,
-                 llvm::Optional<llvm::StringRef> request_path = std::nullopt,
-                 llvm::Optional<uint32_t> request_line = std::nullopt);
+                 std::optional<llvm::StringRef> request_path = std::nullopt,
+                 std::optional<uint32_t> request_line = std::nullopt);
 
 /// Converts a LLDB module to a VS Code DAP module for use in "modules" events.
 ///

diff  --git a/lldb/tools/lldb-vscode/ProgressEvent.cpp b/lldb/tools/lldb-vscode/ProgressEvent.cpp
index 57658768eac1b..443d04892b422 100644
--- a/lldb/tools/lldb-vscode/ProgressEvent.cpp
+++ b/lldb/tools/lldb-vscode/ProgressEvent.cpp
@@ -22,7 +22,8 @@ const std::chrono::duration<double> kStartProgressEventReportDelay =
 const std::chrono::duration<double> kUpdateProgressEventReportDelay =
     std::chrono::milliseconds(250);
 
-ProgressEvent::ProgressEvent(uint64_t progress_id, Optional<StringRef> message,
+ProgressEvent::ProgressEvent(uint64_t progress_id,
+                             std::optional<StringRef> message,
                              uint64_t completed, uint64_t total,
                              const ProgressEvent *prev_event)
     : m_progress_id(progress_id) {
@@ -63,11 +64,10 @@ ProgressEvent::ProgressEvent(uint64_t progress_id, Optional<StringRef> message,
   }
 }
 
-Optional<ProgressEvent> ProgressEvent::Create(uint64_t progress_id,
-                                              Optional<StringRef> message,
-                                              uint64_t completed,
-                                              uint64_t total,
-                                              const ProgressEvent *prev_event) {
+std::optional<ProgressEvent>
+ProgressEvent::Create(uint64_t progress_id, std::optional<StringRef> message,
+                      uint64_t completed, uint64_t total,
+                      const ProgressEvent *prev_event) {
   // If it's an update without a previous event, we abort
   if (completed > 0 && completed < total && !prev_event)
     return std::nullopt;
@@ -163,7 +163,7 @@ const ProgressEvent &ProgressEventManager::GetMostRecentEvent() const {
 
 void ProgressEventManager::Update(uint64_t progress_id, uint64_t completed,
                                   uint64_t total) {
-  if (Optional<ProgressEvent> event = ProgressEvent::Create(
+  if (std::optional<ProgressEvent> event = ProgressEvent::Create(
           progress_id, std::nullopt, completed, total, &GetMostRecentEvent())) {
     if (event->GetEventType() == progressEnd)
       m_finished = true;
@@ -216,8 +216,8 @@ void ProgressEventReporter::Push(uint64_t progress_id, const char *message,
 
   auto it = m_event_managers.find(progress_id);
   if (it == m_event_managers.end()) {
-    if (Optional<ProgressEvent> event =
-            ProgressEvent::Create(progress_id, StringRef(message), completed, total)) {
+    if (std::optional<ProgressEvent> event = ProgressEvent::Create(
+            progress_id, StringRef(message), completed, total)) {
       ProgressEventManagerSP event_manager =
           std::make_shared<ProgressEventManager>(*event, m_report_callback);
       m_event_managers.insert({progress_id, event_manager});

diff  --git a/lldb/tools/lldb-vscode/ProgressEvent.h b/lldb/tools/lldb-vscode/ProgressEvent.h
index 376c4a320768f..85006e4c0a810 100644
--- a/lldb/tools/lldb-vscode/ProgressEvent.h
+++ b/lldb/tools/lldb-vscode/ProgressEvent.h
@@ -47,8 +47,8 @@ class ProgressEvent {
   /// \param[in] prev_event
   ///   Previous event if this one is an update. If \b nullptr, then a start
   ///   event will be created.
-  static llvm::Optional<ProgressEvent>
-  Create(uint64_t progress_id, llvm::Optional<llvm::StringRef> message,
+  static std::optional<ProgressEvent>
+  Create(uint64_t progress_id, std::optional<llvm::StringRef> message,
          uint64_t completed, uint64_t total,
          const ProgressEvent *prev_event = nullptr);
 
@@ -71,14 +71,14 @@ class ProgressEvent {
   bool Reported() const;
 
 private:
-  ProgressEvent(uint64_t progress_id, llvm::Optional<llvm::StringRef> message,
+  ProgressEvent(uint64_t progress_id, std::optional<llvm::StringRef> message,
                 uint64_t completed, uint64_t total,
                 const ProgressEvent *prev_event);
 
   uint64_t m_progress_id;
   std::string m_message;
   ProgressEventType m_event_type;
-  llvm::Optional<uint32_t> m_percentage;
+  std::optional<uint32_t> m_percentage;
   std::chrono::duration<double> m_creation_time =
       std::chrono::system_clock::now().time_since_epoch();
   std::chrono::duration<double> m_minimum_allowed_report_time;
@@ -113,7 +113,7 @@ class ProgressEventManager {
 
 private:
   ProgressEvent m_start_event;
-  llvm::Optional<ProgressEvent> m_last_update_event;
+  std::optional<ProgressEvent> m_last_update_event;
   bool m_finished;
   ProgressEventReportCallback m_report_callback;
 };

diff  --git a/lldb/unittests/DataFormatter/StringPrinterTests.cpp b/lldb/unittests/DataFormatter/StringPrinterTests.cpp
index c9f5fa4e4a71c..5badd825a7665 100644
--- a/lldb/unittests/DataFormatter/StringPrinterTests.cpp
+++ b/lldb/unittests/DataFormatter/StringPrinterTests.cpp
@@ -28,8 +28,8 @@ using llvm::StringRef;
 /// Format \p input according to the specified string encoding and special char
 /// escape style.
 template <StringPrinter::StringElementType elem_ty>
-static Optional<std::string> format(StringRef input,
-                                    StringPrinter::EscapeStyle escape_style) {
+static std::optional<std::string>
+format(StringRef input, StringPrinter::EscapeStyle escape_style) {
   StreamString out;
   StringPrinter::ReadBufferAndDumpToStreamOptions opts;
   opts.SetStream(&out);

diff  --git a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
index a2929a4feab98..6c85ed159df5c 100644
--- a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -41,9 +41,9 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
        "", "operator delete[]",
        "(void*, clang::ASTContext const&, unsigned long)", "",
        "operator delete[]"},
-      {"llvm::Optional<clang::PostInitializer>::operator bool() const", "",
-       "llvm::Optional<clang::PostInitializer>", "operator bool", "()", "const",
-       "llvm::Optional<clang::PostInitializer>::operator bool"},
+      {"std::optional<clang::PostInitializer>::operator bool() const", "",
+       "std::optional<clang::PostInitializer>", "operator bool", "()", "const",
+       "std::optional<clang::PostInitializer>::operator bool"},
       {"(anonymous namespace)::FactManager::operator[](unsigned short)", "",
        "(anonymous namespace)::FactManager", "operator[]", "(unsigned short)",
        "", "(anonymous namespace)::FactManager::operator[]"},
@@ -53,9 +53,9 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
       {"CompareInsn::operator()(llvm::StringRef, InsnMatchEntry const&)", "",
        "CompareInsn", "operator()", "(llvm::StringRef, InsnMatchEntry const&)",
        "", "CompareInsn::operator()"},
-      {"llvm::Optional<llvm::MCFixupKind>::operator*() const &", "",
-       "llvm::Optional<llvm::MCFixupKind>", "operator*", "()", "const &",
-       "llvm::Optional<llvm::MCFixupKind>::operator*"},
+      {"std::optional<llvm::MCFixupKind>::operator*() const &", "",
+       "std::optional<llvm::MCFixupKind>", "operator*", "()", "const &",
+       "std::optional<llvm::MCFixupKind>::operator*"},
       {"auto std::__1::ranges::__begin::__fn::operator()[abi:v160000]<char "
        "const, 18ul>(char const (&) [18ul]) const",
        "auto", "std::__1::ranges::__begin::__fn",
@@ -83,13 +83,13 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
        "main::{lambda()#1}::operator()() const::{lambda()#1}::operator()"},
 
       // Function pointers
-      {"string (*f(vector<int>&&))(float)", "", "", "f",
-       "(vector<int>&&)", "", "f"},
+      {"string (*f(vector<int>&&))(float)", "", "", "f", "(vector<int>&&)", "",
+       "f"},
       {"void (*&std::_Any_data::_M_access<void (*)()>())()", "",
        "std::_Any_data", "_M_access<void (*)()>", "()", "",
        "std::_Any_data::_M_access<void (*)()>"},
-      {"void (*(*(*(*(*(*(*(* const&func1(int))())())())())())())())()", "",
-       "", "func1", "(int)", "", "func1"},
+      {"void (*(*(*(*(*(*(*(* const&func1(int))())())())())())())())()", "", "",
+       "func1", "(int)", "", "func1"},
 
       // Decltype
       {"decltype(nullptr)&& std::forward<decltype(nullptr)>"
@@ -123,9 +123,9 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
       {"f<A<operator<(X,Y)::Subclass>, sizeof(B)<sizeof(C)>()", "", "",
        "f<A<operator<(X,Y)::Subclass>, sizeof(B)<sizeof(C)>", "()", "",
        "f<A<operator<(X,Y)::Subclass>, sizeof(B)<sizeof(C)>"},
-      {"llvm::Optional<llvm::MCFixupKind>::operator*() const volatile &&", "",
-       "llvm::Optional<llvm::MCFixupKind>", "operator*", "()",
-       "const volatile &&", "llvm::Optional<llvm::MCFixupKind>::operator*"},
+      {"std::optional<llvm::MCFixupKind>::operator*() const volatile &&", "",
+       "std::optional<llvm::MCFixupKind>", "operator*", "()",
+       "const volatile &&", "std::optional<llvm::MCFixupKind>::operator*"},
       {"void foo<Dummy<char [10]>>()", "void", "", "foo<Dummy<char [10]>>",
        "()", "", "foo<Dummy<char [10]>>"},
       {"void foo<Bar<Bar<int>[10]>>()", "void", "", "foo<Bar<Bar<int>[10]>>",

diff  --git a/lldb/unittests/Language/Highlighting/HighlighterTest.cpp b/lldb/unittests/Language/Highlighting/HighlighterTest.cpp
index ddf96d3b15df6..d17fddadf9674 100644
--- a/lldb/unittests/Language/Highlighting/HighlighterTest.cpp
+++ b/lldb/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -79,14 +79,14 @@ TEST_F(HighlighterTest, FallbackHighlighter) {
   style.semicolons.Set("<", ">");
 
   const char *code = "program Hello;";
-  std::string output = h.Highlight(style, code, llvm::Optional<size_t>());
+  std::string output = h.Highlight(style, code, std::optional<size_t>());
 
   EXPECT_STREQ(output.c_str(), code);
 }
 
 static std::string
 highlightDefault(llvm::StringRef code, HighlightStyle style,
-                 llvm::Optional<size_t> cursor = llvm::Optional<size_t>()) {
+                 std::optional<size_t> cursor = std::optional<size_t>()) {
   HighlighterManager mgr;
   return mgr.getDefaultHighlighter().Highlight(style, code, cursor);
 }
@@ -116,7 +116,7 @@ TEST_F(HighlighterTest, DefaultHighlighterWithCursorOutOfBounds) {
 
 static std::string
 highlightC(llvm::StringRef code, HighlightStyle style,
-           llvm::Optional<size_t> cursor = llvm::Optional<size_t>()) {
+           std::optional<size_t> cursor = std::optional<size_t>()) {
   HighlighterManager mgr;
   const Highlighter &h = mgr.getHighlighterFor(lldb::eLanguageTypeC, "main.c");
   return h.Highlight(style, code, cursor);

diff  --git a/lldb/unittests/Platform/PlatformSiginfoTest.cpp b/lldb/unittests/Platform/PlatformSiginfoTest.cpp
index 0f70addc8b359..54dbcb41beca3 100644
--- a/lldb/unittests/Platform/PlatformSiginfoTest.cpp
+++ b/lldb/unittests/Platform/PlatformSiginfoTest.cpp
@@ -68,7 +68,7 @@ class PlatformSiginfoTest : public ::testing::Test {
     }
 
     EXPECT_EQ(total_offset, offset * 8);
-    EXPECT_EQ(field_type.GetByteSize(nullptr), llvm::Optional<uint64_t>(size));
+    EXPECT_EQ(field_type.GetByteSize(nullptr), std::optional<uint64_t>(size));
   }
 
   void ExpectFields(const CompilerType &container,

diff  --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index a279038a4181b..f3eea2869048e 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -179,7 +179,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) {
       // the FileSpecs they create.
       FileSpec("/foo/baw.so", FileSpec::Style::windows),
   };
-  std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
+  std::future<std::optional<std::vector<ModuleSpec>>> async_result =
       std::async(std::launch::async,
                  [&] { return client.GetModulesInfo(file_specs, triple); });
   HandlePacket(
@@ -204,7 +204,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) {
   llvm::Triple triple("i386-pc-linux");
 
   FileSpec file_spec("/foo/bar.so", FileSpec::Style::posix);
-  std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
+  std::future<std::optional<std::vector<ModuleSpec>>> async_result =
       std::async(std::launch::async,
                  [&] { return client.GetModulesInfo(file_spec, triple); });
   HandlePacket(
@@ -250,7 +250,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) {
   };
 
   for (const char *response : invalid_responses) {
-    std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
+    std::future<std::optional<std::vector<ModuleSpec>>> async_result =
         std::async(std::launch::async,
                    [&] { return client.GetModulesInfo(file_spec, triple); });
     HandlePacket(
@@ -443,8 +443,8 @@ TEST_F(GDBRemoteCommunicationClientTest, SendTraceSupportedPacket) {
 
 TEST_F(GDBRemoteCommunicationClientTest, GetQOffsets) {
   const auto &GetQOffsets = [&](llvm::StringRef response) {
-    std::future<Optional<QOffsets>> result = std::async(
-        std::launch::async, [&] { return client.GetQOffsets(); });
+    std::future<std::optional<QOffsets>> result =
+        std::async(std::launch::async, [&] { return client.GetQOffsets(); });
 
     HandlePacket(server, "qOffsets", response);
     return result.get();
@@ -470,7 +470,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetQOffsets) {
 static void
 check_qmemtags(TestClient &client, MockServer &server, size_t read_len,
                int32_t type, const char *packet, llvm::StringRef response,
-               llvm::Optional<std::vector<uint8_t>> expected_tag_data) {
+               std::optional<std::vector<uint8_t>> expected_tag_data) {
   const auto &ReadMemoryTags = [&]() {
     std::future<DataBufferSP> result = std::async(std::launch::async, [&] {
       return client.ReadMemoryTags(0xDEF0, read_len, type);

diff  --git a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
index 6068661f8c274..eded318344b37 100644
--- a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -70,7 +70,7 @@ class MinidumpParserTest : public testing::Test {
     return llvm::Error::success();
   }
 
-  llvm::Optional<MinidumpParser> parser;
+  std::optional<MinidumpParser> parser;
 };
 
 TEST_F(MinidumpParserTest, InvalidMinidump) {
@@ -183,7 +183,7 @@ TEST_F(MinidumpParserTest, GetLinuxProcStatus) {
 ...
 )"),
                     llvm::Succeeded());
-  llvm::Optional<LinuxProcStatus> proc_status = parser->GetLinuxProcStatus();
+  std::optional<LinuxProcStatus> proc_status = parser->GetLinuxProcStatus();
   ASSERT_TRUE(proc_status.has_value());
   lldb::pid_t pid = proc_status->GetPid();
   ASSERT_EQ(16001UL, pid);
@@ -218,7 +218,7 @@ TEST_F(MinidumpParserTest, GetPid) {
 ...
 )"),
                     llvm::Succeeded());
-  llvm::Optional<lldb::pid_t> pid = parser->GetPid();
+  std::optional<lldb::pid_t> pid = parser->GetPid();
   ASSERT_TRUE(pid.has_value());
   ASSERT_EQ(16001UL, *pid);
 }
@@ -260,7 +260,7 @@ TEST_F(MinidumpParserTest, GetExceptionStream) {
 
 void check_mem_range_exists(MinidumpParser &parser, const uint64_t range_start,
                             const uint64_t range_size) {
-  llvm::Optional<minidump::Range> range = parser.FindMemoryRange(range_start);
+  std::optional<minidump::Range> range = parser.FindMemoryRange(range_start);
   ASSERT_TRUE(range.has_value()) << "There is no range containing this address";
   EXPECT_EQ(range_start, range->start);
   EXPECT_EQ(range_start + range_size, range->start + range->range_ref.size());
@@ -544,14 +544,14 @@ TEST_F(MinidumpParserTest, GetMiscInfoWindows) {
   SetUpData("fizzbuzz_no_heap.dmp");
   const MinidumpMiscInfo *misc_info = parser->GetMiscInfo();
   ASSERT_NE(nullptr, misc_info);
-  llvm::Optional<lldb::pid_t> pid = misc_info->GetPid();
+  std::optional<lldb::pid_t> pid = misc_info->GetPid();
   ASSERT_TRUE(pid.has_value());
   ASSERT_EQ(4440UL, *pid);
 }
 
 TEST_F(MinidumpParserTest, GetPidWindows) {
   SetUpData("fizzbuzz_no_heap.dmp");
-  llvm::Optional<lldb::pid_t> pid = parser->GetPid();
+  std::optional<lldb::pid_t> pid = parser->GetPid();
   ASSERT_TRUE(pid.has_value());
   ASSERT_EQ(4440UL, *pid);
 }
@@ -559,7 +559,7 @@ TEST_F(MinidumpParserTest, GetPidWindows) {
 // wow64
 TEST_F(MinidumpParserTest, GetPidWow64) {
   SetUpData("fizzbuzz_wow64.dmp");
-  llvm::Optional<lldb::pid_t> pid = parser->GetPid();
+  std::optional<lldb::pid_t> pid = parser->GetPid();
   ASSERT_TRUE(pid.has_value());
   ASSERT_EQ(7836UL, *pid);
 }

diff  --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
index c46fd5e95cb39..4d2f27e0b0d76 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -230,7 +230,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess(
   return false;
 }
 
-llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
+std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
     const char *python_function_name, const char *session_dictionary_name,
     lldb::ThreadSP thread) {
   return std::nullopt;
@@ -242,7 +242,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
   return false;
 }
 
-llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
+std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
     const char *python_function_name, const char *session_dictionary_name,
     lldb::StackFrameSP frame) {
   return std::nullopt;

diff  --git a/lldb/unittests/Symbol/TestLineEntry.cpp b/lldb/unittests/Symbol/TestLineEntry.cpp
index 848bada9dac2b..d8b64c525e10b 100644
--- a/lldb/unittests/Symbol/TestLineEntry.cpp
+++ b/lldb/unittests/Symbol/TestLineEntry.cpp
@@ -40,8 +40,8 @@ class LineEntryTest : public testing::Test {
 
 protected:
   llvm::Expected<SymbolContextList>
-  GetLineEntriesForLine(uint32_t line, llvm::Optional<uint16_t> column);
-  llvm::Optional<TestFile> m_file;
+  GetLineEntriesForLine(uint32_t line, std::optional<uint16_t> column);
+  std::optional<TestFile> m_file;
   ModuleSP m_module_sp;
 };
 
@@ -54,7 +54,7 @@ void LineEntryTest::SetUp() {
 
   // TODO: Handle SourceLocationSpec column information
 llvm::Expected<SymbolContextList> LineEntryTest::GetLineEntriesForLine(
-    uint32_t line, llvm::Optional<uint16_t> column = std::nullopt) {
+    uint32_t line, std::optional<uint16_t> column = std::nullopt) {
   SymbolContextList sc_comp_units;
   SymbolContextList sc_line_entries;
   FileSpec file_spec("inlined-functions.cpp");

diff  --git a/lldb/unittests/Target/FindFileTest.cpp b/lldb/unittests/Target/FindFileTest.cpp
index b632318913dd3..dde2244e84d58 100644
--- a/lldb/unittests/Target/FindFileTest.cpp
+++ b/lldb/unittests/Target/FindFileTest.cpp
@@ -54,7 +54,7 @@ static void TestFileFindings(const PathMappingList &map,
 
   for (const auto &match : matches) {
     SCOPED_TRACE(match.original.GetPath() + " -> " + match.remapped);
-    llvm::Optional<FileSpec> remapped;
+    std::optional<FileSpec> remapped;
 
     EXPECT_TRUE(bool(remapped = map.FindFile(match.original)));
     EXPECT_TRUE(FileSpec(*remapped).GetPath() ==

diff  --git a/lldb/unittests/Target/MemoryTagMapTest.cpp b/lldb/unittests/Target/MemoryTagMapTest.cpp
index 9031eb7763168..cadcecfbb2289 100644
--- a/lldb/unittests/Target/MemoryTagMapTest.cpp
+++ b/lldb/unittests/Target/MemoryTagMapTest.cpp
@@ -29,7 +29,7 @@ TEST(MemoryTagMapTest, EmptyTagMap) {
 }
 
 TEST(MemoryTagMapTest, GetTags) {
-  using TagsVec = std::vector<llvm::Optional<lldb::addr_t>>;
+  using TagsVec = std::vector<std::optional<lldb::addr_t>>;
 
   MemoryTagManagerAArch64MTE manager;
   MemoryTagMap tag_map(&manager);

diff  --git a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h b/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
index b9c36231a62b6..3021ca7c9f8c7 100644
--- a/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
+++ b/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.h
@@ -28,7 +28,7 @@ class YAMLModuleTester {
   SubsystemRAII<FileSystem, HostInfo, TypeSystemClang, ObjectFileELF,
                 SymbolFileDWARF>
       subsystems;
-  llvm::Optional<TestFile> m_file;
+  std::optional<TestFile> m_file;
   lldb::ModuleSP m_module_sp;
   DWARFUnit *m_dwarf_unit;
 

diff  --git a/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp b/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp
index eea5b0eab266a..3ba35d4efacc1 100644
--- a/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp
+++ b/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp
@@ -17,13 +17,13 @@ namespace {
 /// for odd ones.
 class DummyUserIDResolver : public UserIDResolver {
 protected:
-  llvm::Optional<std::string> DoGetUserName(id_t uid) override {
+  std::optional<std::string> DoGetUserName(id_t uid) override {
     if (uid % 2)
       return ("user" + llvm::Twine(uid)).str();
     return std::nullopt;
   }
 
-  llvm::Optional<std::string> DoGetGroupName(id_t gid) override {
+  std::optional<std::string> DoGetGroupName(id_t gid) override {
     if (gid % 2)
       return ("group" + llvm::Twine(gid)).str();
     return std::nullopt;

diff  --git a/lldb/unittests/Utility/RegisterValueTest.cpp b/lldb/unittests/Utility/RegisterValueTest.cpp
index 5ac1b9026a49b..e0863a41605e6 100644
--- a/lldb/unittests/Utility/RegisterValueTest.cpp
+++ b/lldb/unittests/Utility/RegisterValueTest.cpp
@@ -25,7 +25,7 @@ TEST(RegisterValueTest, GetSet8) {
 
 TEST(RegisterValueTest, GetScalarValue) {
   using RV = RegisterValue;
-  const auto &Get = [](const RV &V) -> llvm::Optional<Scalar> {
+  const auto &Get = [](const RV &V) -> std::optional<Scalar> {
     Scalar S;
     if (V.GetScalarValue(S))
       return S;

diff  --git a/lldb/unittests/Utility/UserIDResolverTest.cpp b/lldb/unittests/Utility/UserIDResolverTest.cpp
index 3022e664e969c..cb173b649ff18 100644
--- a/lldb/unittests/Utility/UserIDResolverTest.cpp
+++ b/lldb/unittests/Utility/UserIDResolverTest.cpp
@@ -16,8 +16,8 @@ using namespace testing;
 namespace {
 class TestUserIDResolver : public UserIDResolver {
 public:
-  MOCK_METHOD1(DoGetUserName, llvm::Optional<std::string>(id_t uid));
-  MOCK_METHOD1(DoGetGroupName, llvm::Optional<std::string>(id_t gid));
+  MOCK_METHOD1(DoGetUserName, std::optional<std::string>(id_t uid));
+  MOCK_METHOD1(DoGetGroupName, std::optional<std::string>(id_t gid));
 };
 } // namespace
 

diff  --git a/lldb/unittests/tools/lldb-server/tests/TestClient.h b/lldb/unittests/tools/lldb-server/tests/TestClient.h
index 7dedd54316d4f..09d7131adf400 100644
--- a/lldb/unittests/tools/lldb-server/tests/TestClient.h
+++ b/lldb/unittests/tools/lldb-server/tests/TestClient.h
@@ -93,7 +93,7 @@ class TestClient
       lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult
           result);
 
-  llvm::Optional<ProcessInfo> m_process_info;
+  std::optional<ProcessInfo> m_process_info;
   std::unique_ptr<StopReply> m_stop_reply;
   std::vector<lldb_private::RegisterInfo> m_register_infos;
   unsigned int m_pc_register = LLDB_INVALID_REGNUM;


        


More information about the lldb-commits mailing list