From 2fe8327406050d2585d2ced910a678e28caefcf5 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 7 Jan 2023 14:18:35 -0800 Subject: [PATCH] [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 --- lldb/bindings/python/python-wrapper.swig | 4 +- lldb/docs/resources/contributing.rst | 2 +- lldb/include/lldb/Breakpoint/BreakpointID.h | 2 +- lldb/include/lldb/Breakpoint/BreakpointResolver.h | 2 +- .../lldb/Breakpoint/BreakpointResolverFileLine.h | 4 +- lldb/include/lldb/Core/DataFileCache.h | 6 +- lldb/include/lldb/Core/Debugger.h | 14 +- lldb/include/lldb/Core/EmulateInstruction.h | 4 +- lldb/include/lldb/Core/Highlighter.h | 6 +- lldb/include/lldb/Core/IOHandler.h | 6 +- lldb/include/lldb/Core/Module.h | 12 +- lldb/include/lldb/Core/Progress.h | 2 +- lldb/include/lldb/Core/SourceLocationSpec.h | 6 +- lldb/include/lldb/Core/SourceManager.h | 2 +- lldb/include/lldb/Core/ValueObject.h | 2 +- lldb/include/lldb/Core/ValueObjectCast.h | 2 +- lldb/include/lldb/Core/ValueObjectChild.h | 4 +- lldb/include/lldb/Core/ValueObjectConstResult.h | 4 +- lldb/include/lldb/Core/ValueObjectDynamicValue.h | 2 +- lldb/include/lldb/Core/ValueObjectMemory.h | 2 +- lldb/include/lldb/Core/ValueObjectRegister.h | 4 +- .../include/lldb/Core/ValueObjectSyntheticFilter.h | 2 +- lldb/include/lldb/Core/ValueObjectVariable.h | 2 +- lldb/include/lldb/Expression/ExpressionVariable.h | 4 +- lldb/include/lldb/Host/Editline.h | 2 +- lldb/include/lldb/Host/File.h | 8 +- lldb/include/lldb/Host/FileSystem.h | 2 +- lldb/include/lldb/Host/HostInfoBase.h | 3 +- .../lldb/Host/common/NativeProcessProtocol.h | 6 +- lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h | 2 +- lldb/include/lldb/Host/linux/Host.h | 2 +- lldb/include/lldb/Host/linux/HostInfoLinux.h | 2 +- lldb/include/lldb/Host/macosx/HostInfoMacOSX.h | 2 +- lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h | 2 +- lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h | 2 +- lldb/include/lldb/Host/posix/HostInfoPosix.h | 2 +- lldb/include/lldb/Host/windows/HostInfoWindows.h | 4 +- lldb/include/lldb/Interpreter/CommandHistory.h | 2 +- lldb/include/lldb/Interpreter/CommandInterpreter.h | 4 +- lldb/include/lldb/Interpreter/CommandObject.h | 2 +- .../lldb/Interpreter/CommandObjectMultiword.h | 8 +- lldb/include/lldb/Interpreter/ScriptInterpreter.h | 2 +- .../lldb/Interpreter/ScriptedProcessInterface.h | 10 +- lldb/include/lldb/Symbol/CompilerType.h | 9 +- lldb/include/lldb/Symbol/DWARFCallFrameInfo.h | 2 +- lldb/include/lldb/Symbol/ObjectFile.h | 2 +- lldb/include/lldb/Symbol/SymbolFile.h | 4 +- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 2 +- lldb/include/lldb/Symbol/Type.h | 4 +- lldb/include/lldb/Symbol/TypeSystem.h | 12 +- lldb/include/lldb/Symbol/UnwindTable.h | 4 +- lldb/include/lldb/Target/LanguageRuntime.h | 2 +- lldb/include/lldb/Target/MemoryRegionInfo.h | 4 +- lldb/include/lldb/Target/MemoryTagMap.h | 8 +- lldb/include/lldb/Target/PathMappingList.h | 10 +- lldb/include/lldb/Target/Platform.h | 8 +- lldb/include/lldb/Target/RemoteAwarePlatform.h | 4 +- lldb/include/lldb/Target/StackFrameRecognizer.h | 2 +- lldb/include/lldb/Target/Statistics.h | 6 +- lldb/include/lldb/Target/Trace.h | 16 +- lldb/include/lldb/Target/TraceCursor.h | 2 +- lldb/include/lldb/Target/TraceDumper.h | 21 +- lldb/include/lldb/Target/UnixSignals.h | 6 +- lldb/include/lldb/Utility/Diagnostics.h | 2 +- lldb/include/lldb/Utility/FileSpec.h | 2 +- lldb/include/lldb/Utility/Predicate.h | 4 +- lldb/include/lldb/Utility/SelectHelper.h | 2 +- .../lldb/Utility/StringExtractorGDBRemote.h | 2 +- lldb/include/lldb/Utility/Timeout.h | 6 +- lldb/include/lldb/Utility/UriParser.h | 4 +- lldb/include/lldb/Utility/UserIDResolver.h | 14 +- lldb/source/API/SBCommandInterpreter.cpp | 8 +- lldb/source/API/SBMemoryRegionInfo.cpp | 4 +- lldb/source/API/SBType.cpp | 2 +- lldb/source/Breakpoint/BreakpointID.cpp | 2 +- lldb/source/Breakpoint/BreakpointResolver.cpp | 4 +- .../Breakpoint/BreakpointResolverFileLine.cpp | 10 +- lldb/source/Commands/CommandObjectBreakpoint.cpp | 2 +- lldb/source/Commands/CommandObjectCommands.cpp | 4 +- lldb/source/Commands/CommandObjectFrame.cpp | 8 +- lldb/source/Commands/CommandObjectMemory.cpp | 22 +-- lldb/source/Commands/CommandObjectMultiword.cpp | 4 +- lldb/source/Commands/CommandObjectProcess.cpp | 4 +- lldb/source/Commands/CommandObjectSource.cpp | 4 +- lldb/source/Commands/CommandObjectThread.cpp | 18 +- lldb/source/Core/Debugger.cpp | 12 +- lldb/source/Core/DumpDataExtractor.cpp | 25 ++- lldb/source/Core/EmulateInstruction.cpp | 12 +- lldb/source/Core/Highlighter.cpp | 4 +- lldb/source/Core/IOHandler.cpp | 10 +- lldb/source/Core/IOHandlerCursesGUI.cpp | 2 +- lldb/source/Core/Module.cpp | 7 +- lldb/source/Core/SourceLocationSpec.cpp | 6 +- lldb/source/Core/SourceManager.cpp | 4 +- lldb/source/Core/Value.cpp | 4 +- lldb/source/Core/ValueObject.cpp | 8 +- lldb/source/Core/ValueObjectCast.cpp | 2 +- lldb/source/Core/ValueObjectConstResult.cpp | 2 +- lldb/source/Core/ValueObjectDynamicValue.cpp | 2 +- lldb/source/Core/ValueObjectMemory.cpp | 2 +- lldb/source/Core/ValueObjectRegister.cpp | 4 +- lldb/source/Core/ValueObjectSyntheticFilter.cpp | 2 +- lldb/source/Core/ValueObjectVariable.cpp | 2 +- lldb/source/DataFormatters/TypeFormat.cpp | 2 +- lldb/source/DataFormatters/VectorType.cpp | 6 +- lldb/source/Expression/DWARFExpression.cpp | 8 +- lldb/source/Expression/ExpressionVariable.cpp | 2 +- lldb/source/Expression/IRExecutionUnit.cpp | 2 +- lldb/source/Expression/Materializer.cpp | 18 +- lldb/source/Host/common/Editline.cpp | 4 +- lldb/source/Host/common/File.cpp | 4 +- lldb/source/Host/common/FileSystem.cpp | 4 +- lldb/source/Host/common/HostInfoBase.cpp | 4 +- lldb/source/Host/common/NativeProcessProtocol.cpp | 4 +- lldb/source/Host/common/Terminal.cpp | 4 +- lldb/source/Host/freebsd/HostInfoFreeBSD.cpp | 2 +- lldb/source/Host/linux/Host.cpp | 2 +- lldb/source/Host/linux/HostInfoLinux.cpp | 2 +- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | 2 +- lldb/source/Host/netbsd/HostInfoNetBSD.cpp | 2 +- lldb/source/Host/openbsd/HostInfoOpenBSD.cpp | 2 +- lldb/source/Host/posix/HostInfoPosix.cpp | 16 +- lldb/source/Host/windows/HostInfoWindows.cpp | 8 +- lldb/source/Interpreter/CommandHistory.cpp | 2 +- lldb/source/Interpreter/CommandInterpreter.cpp | 4 +- lldb/source/Interpreter/ScriptInterpreter.cpp | 2 +- lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp | 8 +- .../source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp | 9 +- lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp | 9 +- lldb/source/Plugins/ABI/ARC/ABISysV_arc.h | 2 +- lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp | 6 +- lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp | 11 +- lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp | 2 +- lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp | 7 +- lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp | 14 +- lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp | 8 +- lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp | 8 +- lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp | 4 +- lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp | 6 +- lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp | 16 +- lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp | 16 +- lldb/source/Plugins/ABI/X86/ABIX86.cpp | 2 +- .../Disassembler/LLVMC/DisassemblerLLVMC.cpp | 4 +- .../Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h | 2 +- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 6 +- .../Plugins/ExpressionParser/Clang/ASTUtils.h | 2 +- .../ExpressionParser/Clang/ClangASTImporter.cpp | 2 +- .../Clang/ClangExpressionParser.cpp | 4 +- .../Clang/ClangExternalASTSourceCallbacks.cpp | 2 +- .../Clang/ClangExternalASTSourceCallbacks.h | 2 +- .../Clang/ClangPersistentVariables.cpp | 2 +- .../Clang/ClangPersistentVariables.h | 2 +- .../ExpressionParser/Clang/ClangUserExpression.h | 2 +- .../Clang/CppModuleConfiguration.cpp | 4 +- .../ExpressionParser/Clang/CxxModuleHandler.cpp | 4 +- .../ExpressionParser/Clang/CxxModuleHandler.h | 4 +- .../Plugins/ExpressionParser/Clang/IRForTarget.cpp | 7 +- .../Instruction/ARM/EmulateInstructionARM.cpp | 218 ++++++++++----------- .../Instruction/ARM/EmulateInstructionARM.h | 4 +- .../Instruction/ARM64/EmulateInstructionARM64.cpp | 22 +-- .../Instruction/ARM64/EmulateInstructionARM64.h | 2 +- .../LoongArch/EmulateInstructionLoongArch.cpp | 2 +- .../LoongArch/EmulateInstructionLoongArch.h | 4 +- .../Instruction/MIPS/EmulateInstructionMIPS.cpp | 34 ++-- .../Instruction/MIPS/EmulateInstructionMIPS.h | 2 +- .../MIPS64/EmulateInstructionMIPS64.cpp | 14 +- .../Instruction/MIPS64/EmulateInstructionMIPS64.h | 2 +- .../Instruction/PPC64/EmulateInstructionPPC64.cpp | 14 +- .../Instruction/PPC64/EmulateInstructionPPC64.h | 4 +- .../Instruction/RISCV/EmulateInstructionRISCV.cpp | 40 ++-- .../Instruction/RISCV/EmulateInstructionRISCV.h | 12 +- .../Plugins/Instruction/RISCV/RISCVInstructions.h | 12 +- .../Language/CPlusPlus/CPlusPlusNameParser.cpp | 16 +- .../Language/CPlusPlus/CPlusPlusNameParser.h | 10 +- .../Plugins/Language/CPlusPlus/CxxStringTypes.cpp | 4 +- .../Plugins/Language/CPlusPlus/GenericBitset.cpp | 4 +- lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp | 8 +- .../Language/CPlusPlus/LibCxxInitializerList.cpp | 2 +- .../Plugins/Language/CPlusPlus/LibCxxSpan.cpp | 2 +- .../Plugins/Language/CPlusPlus/LibCxxVariant.cpp | 4 +- .../Plugins/Language/CPlusPlus/LibCxxVector.cpp | 4 +- .../Plugins/Language/CPlusPlus/LibStdcpp.cpp | 2 +- .../Language/ClangCommon/ClangHighlighter.cpp | 2 +- .../Language/ClangCommon/ClangHighlighter.h | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntime.h | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h | 2 +- .../LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp | 2 +- .../LanguageRuntime/ObjC/ObjCLanguageRuntime.h | 2 +- .../Mach-O-Fileset/ObjectContainerMachOFileset.cpp | 8 +- .../ObjectFile/Breakpad/BreakpadRecords.cpp | 27 ++- .../Plugins/ObjectFile/Breakpad/BreakpadRecords.h | 26 +-- .../ObjectFile/Breakpad/ObjectFileBreakpad.cpp | 12 +- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 6 +- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 2 +- .../Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 6 +- .../Plugins/ObjectFile/Mach-O/ObjectFileMachO.h | 4 +- .../Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 2 +- .../Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h | 4 +- .../Plugins/ObjectFile/wasm/ObjectFileWasm.cpp | 8 +- .../Plugins/ObjectFile/wasm/ObjectFileWasm.h | 2 +- .../Plugins/Platform/Android/PlatformAndroid.cpp | 2 +- .../Android/PlatformAndroidRemoteGDBServer.cpp | 6 +- .../Android/PlatformAndroidRemoteGDBServer.h | 2 +- .../Platform/MacOSX/PlatformAppleSimulator.h | 4 +- .../Plugins/Platform/MacOSX/PlatformDarwin.cpp | 2 +- .../Plugins/Platform/MacOSX/PlatformDarwin.h | 2 +- .../Platform/MacOSX/PlatformDarwinDevice.cpp | 2 +- .../Platform/MacOSX/PlatformRemoteDarwinDevice.cpp | 2 +- .../PlatformiOSSimulatorCoreSimulatorSupport.h | 8 +- .../Plugins/Platform/POSIX/PlatformPOSIX.cpp | 5 +- .../Plugins/Platform/Windows/PlatformWindows.cpp | 2 +- .../gdb-server/PlatformRemoteGDBServer.cpp | 10 +- .../Platform/gdb-server/PlatformRemoteGDBServer.h | 8 +- .../NativeRegisterContextFreeBSD_mips64.cpp | 6 +- .../FreeBSD/NativeRegisterContextFreeBSD_mips64.h | 2 +- .../NativeRegisterContextFreeBSD_powerpc.cpp | 6 +- .../FreeBSD/NativeRegisterContextFreeBSD_powerpc.h | 2 +- .../NativeRegisterContextFreeBSD_x86_64.cpp | 12 +- .../FreeBSD/NativeRegisterContextFreeBSD_x86_64.h | 4 +- .../Plugins/Process/Linux/IntelPTCollector.cpp | 4 +- .../Process/Linux/IntelPTMultiCoreTrace.cpp | 2 +- .../Plugins/Process/Linux/IntelPTMultiCoreTrace.h | 2 +- .../Process/Linux/IntelPTPerThreadProcessTrace.cpp | 2 +- .../Process/Linux/IntelPTPerThreadProcessTrace.h | 2 +- .../Plugins/Process/Linux/IntelPTProcessTrace.h | 2 +- .../Process/Linux/IntelPTThreadTraceCollection.cpp | 2 +- .../Process/Linux/IntelPTThreadTraceCollection.h | 2 +- .../Plugins/Process/Linux/NativeProcessLinux.cpp | 10 +- .../Process/Linux/NativeRegisterContextLinux.h | 4 +- .../Linux/NativeRegisterContextLinux_arm64.cpp | 4 +- .../Linux/NativeRegisterContextLinux_x86_64.cpp | 4 +- .../Linux/NativeRegisterContextLinux_x86_64.h | 4 +- lldb/source/Plugins/Process/Linux/Procfs.cpp | 2 +- .../NetBSD/NativeRegisterContextNetBSD_x86_64.cpp | 12 +- .../NetBSD/NativeRegisterContextNetBSD_x86_64.h | 4 +- .../Plugins/Process/POSIX/NativeProcessELF.cpp | 8 +- .../Plugins/Process/POSIX/NativeProcessELF.h | 4 +- lldb/source/Plugins/Process/Utility/AuxVector.cpp | 2 +- lldb/source/Plugins/Process/Utility/AuxVector.h | 2 +- .../Plugins/Process/Utility/LinuxProcMaps.cpp | 2 +- .../Process/Utility/StopInfoMachException.cpp | 6 +- .../Process/Utility/StopInfoMachException.h | 2 +- .../Process/Windows/Common/DebuggerThread.cpp | 4 +- .../Plugins/Process/elf-core/RegisterUtilities.cpp | 2 +- .../gdb-remote/GDBRemoteCommunicationClient.cpp | 32 ++- .../gdb-remote/GDBRemoteCommunicationClient.h | 16 +- .../GDBRemoteCommunicationServerCommon.cpp | 8 +- .../GDBRemoteCommunicationServerLLGS.cpp | 6 +- .../GDBRemoteCommunicationServerPlatform.cpp | 6 +- .../GDBRemoteCommunicationServerPlatform.h | 2 +- .../Process/gdb-remote/ProcessGDBRemote.cpp | 2 +- .../Plugins/Process/gdb-remote/ProcessGDBRemote.h | 2 +- .../Plugins/Process/minidump/MinidumpParser.cpp | 10 +- .../Plugins/Process/minidump/MinidumpParser.h | 6 +- .../Plugins/Process/minidump/MinidumpTypes.cpp | 6 +- .../Plugins/Process/minidump/MinidumpTypes.h | 4 +- .../Plugins/Process/minidump/ProcessMinidump.cpp | 2 +- .../Plugins/Process/minidump/ProcessMinidump.h | 4 +- .../Plugins/Process/scripted/ScriptedThread.cpp | 8 +- .../ScriptInterpreter/Python/SWIGPythonBridge.h | 4 +- .../Python/ScriptInterpreterPython.cpp | 4 +- .../Python/ScriptedProcessPythonInterface.cpp | 6 +- .../Python/ScriptedProcessPythonInterface.h | 4 +- .../Python/ScriptedPythonInterface.cpp | 4 +- .../Python/ScriptedPythonInterface.h | 4 +- .../Python/ScriptedThreadPythonInterface.cpp | 7 +- .../Python/ScriptedThreadPythonInterface.h | 6 +- .../SymbolFile/Breakpad/SymbolFileBreakpad.cpp | 12 +- .../SymbolFile/Breakpad/SymbolFileBreakpad.h | 12 +- lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp | 4 +- lldb/source/Plugins/SymbolFile/DWARF/DIERef.h | 8 +- .../Plugins/SymbolFile/DWARF/DWARFASTParser.cpp | 2 +- .../Plugins/SymbolFile/DWARF/DWARFASTParser.h | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 14 +- .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.h | 2 +- .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp | 4 +- .../source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h | 4 +- .../Plugins/SymbolFile/DWARF/DWARFContext.cpp | 4 +- .../source/Plugins/SymbolFile/DWARF/DWARFContext.h | 4 +- .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp | 7 +- .../Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h | 2 +- .../Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 8 +- .../Plugins/SymbolFile/DWARF/DWARFFormValue.h | 6 +- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 6 +- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h | 30 +-- .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 8 +- .../SymbolFile/DWARF/DebugNamesDWARFIndex.h | 2 +- .../Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 2 +- lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp | 2 +- .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 37 ++-- .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 12 +- .../SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 2 +- .../SymbolFile/DWARF/SymbolFileDWARFDebugMap.h | 2 +- .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp | 2 +- .../Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h | 2 +- .../SymbolFile/NativePDB/CompileUnitIndex.h | 4 +- .../NativePDB/DWARFLocationExpression.cpp | 8 +- .../Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp | 13 +- .../Plugins/SymbolFile/NativePDB/PdbAstBuilder.h | 2 +- .../Plugins/SymbolFile/NativePDB/PdbIndex.cpp | 8 +- .../source/Plugins/SymbolFile/NativePDB/PdbIndex.h | 6 +- .../SymbolFile/NativePDB/SymbolFileNativePDB.cpp | 26 +-- .../SymbolFile/NativePDB/SymbolFileNativePDB.h | 6 +- .../SymbolFile/NativePDB/UdtRecordCompleter.cpp | 2 +- .../SymbolFile/NativePDB/UdtRecordCompleter.h | 2 +- .../source/Plugins/SymbolFile/PDB/PDBASTParser.cpp | 6 +- .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 2 +- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h | 2 +- .../Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp | 2 +- .../Plugins/SymbolFile/Symtab/SymbolFileSymtab.h | 2 +- .../Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp | 2 +- .../Plugins/Trace/common/ThreadPostMortemTrace.cpp | 2 +- .../Plugins/Trace/common/ThreadPostMortemTrace.h | 6 +- .../intel-pt/CommandObjectTraceStartIntelPT.cpp | 8 +- .../intel-pt/CommandObjectTraceStartIntelPT.h | 6 +- .../Plugins/Trace/intel-pt/DecodedThread.cpp | 6 +- lldb/source/Plugins/Trace/intel-pt/DecodedThread.h | 14 +- .../Plugins/Trace/intel-pt/LibiptDecoder.cpp | 36 ++-- lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h | 6 +- .../Trace/intel-pt/PerfContextSwitchDecoder.cpp | 4 +- .../Plugins/Trace/intel-pt/ThreadDecoder.cpp | 7 +- lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h | 4 +- .../Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp | 14 +- .../Plugins/Trace/intel-pt/TraceCursorIntelPT.h | 22 +-- .../source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | 38 ++-- lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h | 18 +- .../Trace/intel-pt/TraceIntelPTBundleLoader.cpp | 2 +- .../Trace/intel-pt/TraceIntelPTBundleSaver.cpp | 16 +- .../Plugins/Trace/intel-pt/TraceIntelPTConstants.h | 2 +- .../Trace/intel-pt/TraceIntelPTJSONStructs.cpp | 3 +- .../Trace/intel-pt/TraceIntelPTJSONStructs.h | 20 +- .../Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp | 8 +- .../Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h | 6 +- .../Plugins/TraceExporter/common/TraceHTR.cpp | 16 +- .../source/Plugins/TraceExporter/common/TraceHTR.h | 6 +- .../ctf/CommandObjectThreadTraceExportCTF.h | 2 +- .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 30 +-- .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 21 +- lldb/source/Symbol/CompileUnit.cpp | 7 +- lldb/source/Symbol/CompilerType.cpp | 13 +- lldb/source/Symbol/DWARFCallFrameInfo.cpp | 4 +- lldb/source/Symbol/PostfixExpression.cpp | 4 +- lldb/source/Symbol/SymbolFileOnDemand.cpp | 2 +- lldb/source/Symbol/Type.cpp | 9 +- lldb/source/Symbol/TypeSystem.cpp | 12 +- lldb/source/Symbol/UnwindPlan.cpp | 2 +- lldb/source/Symbol/UnwindTable.cpp | 4 +- lldb/source/Target/MemoryTagMap.cpp | 8 +- lldb/source/Target/PathMappingList.cpp | 12 +- lldb/source/Target/Platform.cpp | 8 +- lldb/source/Target/Process.cpp | 2 +- lldb/source/Target/RemoteAwarePlatform.cpp | 4 +- lldb/source/Target/Target.cpp | 4 +- lldb/source/Target/Thread.cpp | 2 +- lldb/source/Target/Trace.cpp | 28 +-- lldb/source/Target/TraceDumper.cpp | 6 +- lldb/source/Target/UnixSignals.cpp | 6 +- lldb/source/Utility/Diagnostics.cpp | 4 +- lldb/source/Utility/FileSpec.cpp | 3 +- lldb/source/Utility/ProcessInfo.cpp | 2 +- lldb/source/Utility/SelectHelper.cpp | 10 +- lldb/source/Utility/StringExtractorGDBRemote.cpp | 2 +- lldb/source/Utility/UriParser.cpp | 2 +- lldb/source/Utility/UserIDResolver.cpp | 8 +- lldb/tools/lldb-server/Acceptor.cpp | 2 +- lldb/tools/lldb-server/lldb-platform.cpp | 2 +- lldb/tools/lldb-test/lldb-test.cpp | 4 +- lldb/tools/lldb-vscode/FifoFiles.cpp | 2 +- lldb/tools/lldb-vscode/JSONUtils.cpp | 8 +- lldb/tools/lldb-vscode/JSONUtils.h | 8 +- lldb/tools/lldb-vscode/ProgressEvent.cpp | 18 +- lldb/tools/lldb-vscode/ProgressEvent.h | 10 +- .../unittests/DataFormatter/StringPrinterTests.cpp | 4 +- .../Language/CPlusPlus/CPlusPlusLanguageTest.cpp | 26 +-- .../Language/Highlighting/HighlighterTest.cpp | 6 +- lldb/unittests/Platform/PlatformSiginfoTest.cpp | 2 +- .../GDBRemoteCommunicationClientTest.cpp | 12 +- .../Process/minidump/MinidumpParserTest.cpp | 14 +- .../ScriptInterpreter/Python/PythonTestSuite.cpp | 4 +- lldb/unittests/Symbol/TestLineEntry.cpp | 6 +- lldb/unittests/Target/FindFileTest.cpp | 2 +- lldb/unittests/Target/MemoryTagMapTest.cpp | 2 +- .../TestingSupport/Symbol/YAMLModuleTester.h | 2 +- lldb/unittests/Utility/ProcessInstanceInfoTest.cpp | 4 +- lldb/unittests/Utility/RegisterValueTest.cpp | 2 +- lldb/unittests/Utility/UserIDResolverTest.cpp | 4 +- .../unittests/tools/lldb-server/tests/TestClient.h | 2 +- 387 files changed, 1323 insertions(+), 1324 deletions(-) diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 7342d9d..91b26ff 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 lldb_private::LLDBSWIGPythonRunScriptKeywordThread( +std::optional 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 lldb_private::LLDBSWIGPythonRunScriptKeywordFrame( +std::optional 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 26b13a5..b2d4cf0 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 `_ or - `llvm::Optional + `std::optional `_ 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 4d171f0..dff9011 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointID.h +++ b/lldb/include/lldb/Breakpoint/BreakpointID.h @@ -58,7 +58,7 @@ public: /// 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 + static std::optional 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 6c71f19..a0b37c9 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h @@ -206,7 +206,7 @@ protected: void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, llvm::StringRef log_ident, uint32_t line = 0, - llvm::Optional column = std::nullopt); + std::optional 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 5bf8d3e..5864a28 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -25,7 +25,7 @@ public: BreakpointResolverFileLine( const lldb::BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue, const SourceLocationSpec &location_spec, - llvm::Optional removed_prefix_opt = std::nullopt); + std::optional removed_prefix_opt = std::nullopt); static BreakpointResolver * CreateFromStructuredData(const lldb::BreakpointSP &bkpt, @@ -66,7 +66,7 @@ protected: 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 m_removed_prefix_opt; + std::optional 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 4ad943c..5b63443 100644 --- a/lldb/include/lldb/Core/DataFileCache.h +++ b/lldb/include/lldb/Core/DataFileCache.h @@ -108,13 +108,13 @@ private: /// it is out of date. struct CacheSignature { /// UUID of object file or module. - llvm::Optional m_uuid = std::nullopt; + std::optional m_uuid = std::nullopt; /// Modification time of file on disk. - llvm::Optional m_mod_time = std::nullopt; + std::optional 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 m_obj_mod_time = std::nullopt; + std::optional 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 636ac23..dd3e6c0 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -174,7 +174,7 @@ public: ScriptInterpreter * GetScriptInterpreter(bool can_create = true, - llvm::Optional language = {}); + std::optional language = {}); lldb::ListenerSP GetListener() { return m_listener_sp; } @@ -403,7 +403,7 @@ public: /// ensure the given warning is only broadcast once. static void ReportWarning(std::string message, - llvm::Optional debugger_id = std::nullopt, + std::optional debugger_id = std::nullopt, std::once_flag *once = nullptr); /// Report error events. @@ -425,7 +425,7 @@ public: /// ensure the given error is only broadcast once. static void ReportError(std::string message, - llvm::Optional debugger_id = std::nullopt, + std::optional debugger_id = std::nullopt, std::once_flag *once = nullptr); /// Report info events. @@ -445,7 +445,7 @@ public: /// ensure the given info is only logged once. static void ReportInfo(std::string message, - llvm::Optional debugger_id = std::nullopt, + std::optional debugger_id = std::nullopt, std::once_flag *once = nullptr); static void ReportSymbolChange(const ModuleSpec &module_spec); @@ -486,11 +486,11 @@ protected: /// delivered to all debuggers. static void ReportProgress(uint64_t progress_id, const std::string &message, uint64_t completed, uint64_t total, - llvm::Optional debugger_id); + std::optional debugger_id); static void ReportDiagnosticImpl(DiagnosticEventData::Type type, std::string message, - llvm::Optional debugger_id, + std::optional debugger_id, std::once_flag *once); void PrintProgress(const ProgressEventData &data); @@ -574,7 +574,7 @@ protected: IOHandlerStack m_io_handler_stack; std::recursive_mutex m_io_handler_synchronous_mutex; - llvm::Optional m_current_event_id; + std::optional m_current_event_id; llvm::StringMap> m_stream_handlers; std::shared_ptr m_callback_handler_sp; diff --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h index 2168802..6d76380 100644 --- a/lldb/include/lldb/Core/EmulateInstruction.h +++ b/lldb/include/lldb/Core/EmulateInstruction.h @@ -378,7 +378,7 @@ public: virtual bool TestEmulation(Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0; - virtual llvm::Optional + virtual std::optional GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) = 0; // Optional overrides @@ -391,7 +391,7 @@ public: uint32_t reg_num, std::string ®_name); // RegisterInfo variants - llvm::Optional ReadRegister(const RegisterInfo ®_info); + std::optional ReadRegister(const RegisterInfo ®_info); uint64_t ReadRegisterUnsigned(const RegisterInfo ®_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 258d47c..58ecd37 100644 --- a/lldb/include/lldb/Core/Highlighter.h +++ b/lldb/include/lldb/Core/Highlighter.h @@ -113,12 +113,12 @@ public: /// 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 cursor_pos, + std::optional 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 cursor_pos, + std::optional cursor_pos, llvm::StringRef previous_lines = "") const; }; @@ -129,7 +129,7 @@ public: llvm::StringRef GetName() const override { return "none"; } void Highlight(const HighlightStyle &options, llvm::StringRef line, - llvm::Optional cursor_pos, + std::optional 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 f2f9fa0..18d87ac 100644 --- a/lldb/include/lldb/Core/IOHandler.h +++ b/lldb/include/lldb/Core/IOHandler.h @@ -201,8 +201,8 @@ public: virtual void IOHandlerDeactivated(IOHandler &io_handler) {} - virtual llvm::Optional IOHandlerSuggestion(IOHandler &io_handler, - llvm::StringRef line); + virtual std::optional IOHandlerSuggestion(IOHandler &io_handler, + llvm::StringRef line); virtual void IOHandlerComplete(IOHandler &io_handler, CompletionRequest &request); @@ -418,7 +418,7 @@ private: int FixIndentationCallback(Editline *editline, const StringList &lines, int cursor_position); - llvm::Optional SuggestionCallback(llvm::StringRef line); + std::optional 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 8ea6a27..56c3de1 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -842,11 +842,11 @@ public: void ReportErrorIfModifyDetected(const char *format, ...) __attribute__((format(printf, 2, 3))); - void ReportWarningOptimization(llvm::Optional debugger_id); + void ReportWarningOptimization(std::optional debugger_id); void ReportWarningUnsupportedLanguage(lldb::LanguageType language, - llvm::Optional debugger_id); + std::optional 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 @@ public: /// \return /// The newly remapped filespec that is may or may not exist if /// \a path was successfully located. - llvm::Optional RemapSourceFile(llvm::StringRef path) const; + std::optional 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 @@ protected: 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 m_unwind_table; ///< Table of FuncUnwinders - /// objects created for this - /// Module's functions + std::optional 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 diff --git a/lldb/include/lldb/Core/Progress.h b/lldb/include/lldb/Core/Progress.h index 9238647..4807870 100644 --- a/lldb/include/lldb/Core/Progress.h +++ b/lldb/include/lldb/Core/Progress.h @@ -103,7 +103,7 @@ private: 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 m_debugger_id; + std::optional 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 8fbb32a..3550dc0 100644 --- a/lldb/include/lldb/Core/SourceLocationSpec.h +++ b/lldb/include/lldb/Core/SourceLocationSpec.h @@ -48,7 +48,7 @@ public: /// Whether to look for an exact match. /// explicit SourceLocationSpec(FileSpec file_spec, uint32_t line, - llvm::Optional column = std::nullopt, + std::optional column = std::nullopt, bool check_inlines = false, bool exact_match = false); @@ -166,9 +166,9 @@ public: FileSpec GetFileSpec() const { return m_declaration.GetFile(); } - llvm::Optional GetLine() const; + std::optional GetLine() const; - llvm::Optional GetColumn() const; + std::optional 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 382b206..c272f7f 100644 --- a/lldb/include/lldb/Core/SourceManager.h +++ b/lldb/include/lldb/Core/SourceManager.h @@ -42,7 +42,7 @@ public: void UpdateIfNeeded(); - size_t DisplaySourceLines(uint32_t line, llvm::Optional column, + size_t DisplaySourceLines(uint32_t line, std::optional column, uint32_t context_before, uint32_t context_after, Stream *s); void FindLinesMatchingRegex(RegularExpression ®ex, uint32_t start_line, diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 0f3ae9b..398c6e9 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -358,7 +358,7 @@ public: virtual bool CanProvideValue(); // Subclasses must implement the functions below. - virtual llvm::Optional GetByteSize() = 0; + virtual std::optional 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 b9604ff..fe053c1 100644 --- a/lldb/include/lldb/Core/ValueObjectCast.h +++ b/lldb/include/lldb/Core/ValueObjectCast.h @@ -31,7 +31,7 @@ public: ConstString name, const CompilerType &cast_type); - llvm::Optional GetByteSize() override; + std::optional 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 949b90e..a655911 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 GetByteSize() override { return m_byte_size; } + std::optional GetByteSize() override { return m_byte_size; } lldb::offset_t GetByteOffset() override { return m_byte_offset; } @@ -70,7 +70,7 @@ protected: uint8_t m_bitfield_bit_offset; bool m_is_base_class; bool m_is_deref_of_parent; - llvm::Optional m_can_update_with_invalid_exe_ctx; + std::optional 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 3625828..4edd495 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResult.h +++ b/lldb/include/lldb/Core/ValueObjectConstResult.h @@ -63,7 +63,7 @@ public: static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const Status &error); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; lldb::ValueType GetValueType() const override; @@ -114,7 +114,7 @@ protected: CompilerType GetCompilerTypeImpl() override; ConstString m_type_name; - llvm::Optional m_byte_size; + std::optional m_byte_size; ValueObjectConstResultImpl m_impl; diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h index 36d9be9..2758b4e 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 GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Core/ValueObjectMemory.h b/lldb/include/lldb/Core/ValueObjectMemory.h index 2666ff4..3c01df3 100644 --- a/lldb/include/lldb/Core/ValueObjectMemory.h +++ b/lldb/include/lldb/Core/ValueObjectMemory.h @@ -41,7 +41,7 @@ public: const Address &address, const CompilerType &ast_type); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h index 9277eaa..60c299c 100644 --- a/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/lldb/include/lldb/Core/ValueObjectRegister.h @@ -37,7 +37,7 @@ public: lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; lldb::ValueType GetValueType() const override { return lldb::eValueTypeRegisterSet; @@ -87,7 +87,7 @@ public: lldb::RegisterContextSP ®_ctx_sp, const RegisterInfo *reg_info); - llvm::Optional GetByteSize() override; + std::optional 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 27d25fb..bdd6c1b 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 GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h index 23be7ae..bba28ce 100644 --- a/lldb/include/lldb/Core/ValueObjectVariable.h +++ b/lldb/include/lldb/Core/ValueObjectVariable.h @@ -38,7 +38,7 @@ public: static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Expression/ExpressionVariable.h b/lldb/include/lldb/Expression/ExpressionVariable.h index d1a3261..2734353 100644 --- a/lldb/include/lldb/Expression/ExpressionVariable.h +++ b/lldb/include/lldb/Expression/ExpressionVariable.h @@ -33,7 +33,7 @@ public: virtual ~ExpressionVariable(); - llvm::Optional GetByteSize() { return m_frozen_sp->GetByteSize(); } + std::optional GetByteSize() { return m_frozen_sp->GetByteSize(); } ConstString GetName() { return m_frozen_sp->GetName(); } @@ -227,7 +227,7 @@ public: virtual void RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0; - virtual llvm::Optional + virtual std::optional 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 ee92121..bda3f06 100644 --- a/lldb/include/lldb/Host/Editline.h +++ b/lldb/include/lldb/Host/Editline.h @@ -99,7 +99,7 @@ using FixIndentationCallbackType = llvm::unique_function; using SuggestionCallbackType = - llvm::unique_function(llvm::StringRef)>; + llvm::unique_function(llvm::StringRef)>; using CompleteCallbackType = llvm::unique_function; diff --git a/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h index 85c1ae8..ba5772d 100644 --- a/lldb/include/lldb/Host/File.h +++ b/lldb/include/lldb/Host/File.h @@ -438,10 +438,10 @@ private: class SerialPort : public NativeFile { public: struct Options { - llvm::Optional BaudRate = std::nullopt; - llvm::Optional Parity = std::nullopt; - llvm::Optional ParityCheck = std::nullopt; - llvm::Optional StopBits = std::nullopt; + std::optional BaudRate = std::nullopt; + std::optional Parity = std::nullopt; + std::optional ParityCheck = std::nullopt; + std::optional 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 52242ac..aefad00 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -196,7 +196,7 @@ public: void SetHomeDirectory(std::string home_directory); private: - static llvm::Optional &InstanceImpl(); + static std::optional &InstanceImpl(); llvm::IntrusiveRefCntPtr m_fs; std::string m_home_directory; }; diff --git a/lldb/include/lldb/Host/HostInfoBase.h b/lldb/include/lldb/Host/HostInfoBase.h index 11a50cf..42f71d9 100644 --- a/lldb/include/lldb/Host/HostInfoBase.h +++ b/lldb/include/lldb/Host/HostInfoBase.h @@ -65,7 +65,8 @@ public: static const ArchSpec & GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault); - static llvm::Optional ParseArchitectureKind(llvm::StringRef kind); + static std::optional + 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 b1d6638..057c07b 100644 --- a/lldb/include/lldb/Host/common/NativeProcessProtocol.h +++ b/lldb/include/lldb/Host/common/NativeProcessProtocol.h @@ -172,7 +172,7 @@ public: // Watchpoint functions virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; - virtual llvm::Optional> + virtual std::optional> GetHardwareDebugSupportInfo() const; virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, @@ -205,7 +205,7 @@ public: GetAuxvData() const = 0; // Exit Status - virtual llvm::Optional GetExitStatus(); + virtual std::optional GetExitStatus(); virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange); @@ -423,7 +423,7 @@ protected: lldb::StateType m_state = lldb::eStateInvalid; mutable std::recursive_mutex m_state_mutex; - llvm::Optional m_exit_status; + std::optional 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 1d7d8fe..d265b8a 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 GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); }; } diff --git a/lldb/include/lldb/Host/linux/Host.h b/lldb/include/lldb/Host/linux/Host.h index f17c5b6..08ac41b 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 getPIDForTID(lldb::pid_t tid); +std::optional 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 6cf4ace..2964f3f 100644 --- a/lldb/include/lldb/Host/linux/HostInfoLinux.h +++ b/lldb/include/lldb/Host/linux/HostInfoLinux.h @@ -27,7 +27,7 @@ public: static void Terminate(); static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); + static std::optional 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 ebe77c6..0402509 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 GetOSBuildString(); + static std::optional 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 2024af7..01daefa 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 GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); }; } diff --git a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h index 9746deb..ed8aa2a 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 GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); }; } diff --git a/lldb/include/lldb/Host/posix/HostInfoPosix.h b/lldb/include/lldb/Host/posix/HostInfoPosix.h index 407fa49..8d070d3 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 GetOSKernelDescription(); + static std::optional 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 b8381fa..8a4f5c7 100644 --- a/lldb/include/lldb/Host/windows/HostInfoWindows.h +++ b/lldb/include/lldb/Host/windows/HostInfoWindows.h @@ -28,8 +28,8 @@ public: static UserIDResolver &GetUserIDResolver(); static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); - static llvm::Optional GetOSKernelDescription(); + static std::optional GetOSBuildString(); + static std::optional 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 60a2df3..aa30185 100644 --- a/lldb/include/lldb/Interpreter/CommandHistory.h +++ b/lldb/include/lldb/Interpreter/CommandHistory.h @@ -29,7 +29,7 @@ public: bool IsEmpty() const; - llvm::Optional FindString(llvm::StringRef input_str) const; + std::optional 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 e73999e..38ff061 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -407,7 +407,7 @@ public: /// Returns the auto-suggestion string that should be added to the given /// command line. - llvm::Optional GetAutoSuggestionForCommand(llvm::StringRef line); + std::optional GetAutoSuggestionForCommand(llvm::StringRef line); // This handles command line completion. void HandleCompletion(CompletionRequest &request); @@ -743,7 +743,7 @@ private: // 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 m_quit_exit_code; + std::optional 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 cebd8a3..86750a4 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -278,7 +278,7 @@ public: /// 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 + virtual std::optional GetRepeatCommand(Args ¤t_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 4414011..1c14b49 100644 --- a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h +++ b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h @@ -56,8 +56,8 @@ public: void HandleCompletion(CompletionRequest &request) override; - llvm::Optional GetRepeatCommand(Args ¤t_command_args, - uint32_t index) override; + std::optional GetRepeatCommand(Args ¤t_command_args, + uint32_t index) override; bool Execute(const char *args_string, CommandReturnObject &result) override; @@ -121,8 +121,8 @@ public: HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override; - llvm::Optional GetRepeatCommand(Args ¤t_command_args, - uint32_t index) override; + std::optional GetRepeatCommand(Args ¤t_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 548b84f..ec561804 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -576,7 +576,7 @@ public: Status GetStatusFromSBError(const lldb::SBError &error) const; - llvm::Optional GetOpaqueTypeFromSBMemoryRegionInfo( + std::optional 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 beaadb3..6d1860a 100644 --- a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h +++ b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h @@ -36,7 +36,7 @@ public: virtual Status Stop() { return Status("ScriptedProcess did not stop"); } - virtual llvm::Optional + virtual std::optional GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) { error.SetErrorString("ScriptedProcess have no memory region."); return {}; @@ -63,7 +63,7 @@ public: virtual bool IsAlive() { return true; } - virtual llvm::Optional GetScriptedThreadPluginName() { + virtual std::optional GetScriptedThreadPluginName() { return std::nullopt; } @@ -87,11 +87,11 @@ public: virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; } - virtual llvm::Optional GetName() { return std::nullopt; } + virtual std::optional GetName() { return std::nullopt; } virtual lldb::StateType GetState() { return lldb::eStateInvalid; } - virtual llvm::Optional GetQueue() { return std::nullopt; } + virtual std::optional GetQueue() { return std::nullopt; } virtual StructuredData::DictionarySP GetStopReason() { return {}; } @@ -99,7 +99,7 @@ public: virtual StructuredData::DictionarySP GetRegisterInfo() { return {}; } - virtual llvm::Optional GetRegisterContext() { + virtual std::optional GetRegisterContext() { return std::nullopt; } diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 818420f..c96fc5a 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -327,16 +327,15 @@ public: struct IntegralTemplateArgument; /// Return the size of the type in bytes. - llvm::Optional GetByteSize(ExecutionContextScope *exe_scope) const; + std::optional GetByteSize(ExecutionContextScope *exe_scope) const; /// Return the size of the type in bits. - llvm::Optional GetBitSize(ExecutionContextScope *exe_scope) const; + std::optional GetBitSize(ExecutionContextScope *exe_scope) const; lldb::Encoding GetEncoding(uint64_t &count) const; lldb::Format GetFormat() const; - llvm::Optional - GetTypeBitAlign(ExecutionContextScope *exe_scope) const; + std::optional GetTypeBitAlign(ExecutionContextScope *exe_scope) const; uint32_t GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const; @@ -419,7 +418,7 @@ public: /// 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 + std::optional 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 be70ac4..ea5c325 100644 --- a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h +++ b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -123,7 +123,7 @@ private: bool IsEHFrame() const; - llvm::Optional + std::optional GetFirstFDEEntryInRange(const AddressRange &range); void GetFDEIndex(); diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index f0e1611..bae6e72 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -750,7 +750,7 @@ protected: /// 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 m_symtab_once_up; - llvm::Optional m_cache_hash; + std::optional 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 b4f378f..d5fe033 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -205,7 +205,7 @@ public: /// 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 + virtual std::optional GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) = 0; @@ -502,7 +502,7 @@ protected: // case it isn't the same as the module // object file (debug symbols in a separate // file) - llvm::Optional> m_compile_units; + std::optional> 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 fc9c5800..1f5b0c0 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -97,7 +97,7 @@ public: ParseVariablesForContext(const lldb_private::SymbolContext &sc) override; lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override; - llvm::Optional GetDynamicArrayInfoForUID( + std::optional 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 045db47..d04a0fe 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -102,7 +102,7 @@ public: }; Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, - llvm::Optional byte_size, SymbolContextScope *context, + std::optional 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 @@ public: ConstString GetBaseName(); - llvm::Optional GetByteSize(ExecutionContextScope *exe_scope); + std::optional 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 c3b0ef8..a358d6f 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 GetSingularLanguage(); + std::optional GetSingularLanguage(); void Insert(lldb::LanguageType language); bool Empty() const; size_t Size() const; @@ -286,7 +286,7 @@ public: virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0; - virtual llvm::Optional + virtual std::optional GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) = 0; @@ -369,7 +369,7 @@ public: virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack); - virtual llvm::Optional + virtual std::optional GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack); @@ -435,7 +435,7 @@ public: virtual bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) = 0; - virtual llvm::Optional + virtual std::optional GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) = 0; @@ -517,7 +517,7 @@ public: // meaningless type itself, instead preferring to use the dynamic type virtual bool IsMeaninglessWithoutDynamicResolution(void *type); - virtual llvm::Optional ReportStatistics(); + virtual std::optional ReportStatistics(); bool GetHasForcefullyCompletedTypes() const { return m_has_forcefully_completed_types; @@ -575,7 +575,7 @@ private: /// \return The found type system or an error. llvm::Expected GetTypeSystemForLanguage( lldb::LanguageType language, - llvm::Optional create_callback = std::nullopt); + std::optional create_callback = std::nullopt); }; } // namespace lldb_private diff --git a/lldb/include/lldb/Symbol/UnwindTable.h b/lldb/include/lldb/Symbol/UnwindTable.h index b5e56d3..a302650 100644 --- a/lldb/include/lldb/Symbol/UnwindTable.h +++ b/lldb/include/lldb/Symbol/UnwindTable.h @@ -61,8 +61,8 @@ private: void Dump(Stream &s); void Initialize(); - llvm::Optional GetAddressRange(const Address &addr, - SymbolContext &sc); + std::optional GetAddressRange(const Address &addr, + SymbolContext &sc); typedef std::map collection; typedef collection::iterator iterator; diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index 5cd779f..9cc79dc 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -151,7 +151,7 @@ public: /// from the user interface. virtual bool IsAllowedRuntimeValue(ConstString name) { return false; } - virtual llvm::Optional GetRuntimeType(CompilerType base_type) { + virtual std::optional GetRuntimeType(CompilerType base_type) { return std::nullopt; } diff --git a/lldb/include/lldb/Target/MemoryRegionInfo.h b/lldb/include/lldb/Target/MemoryRegionInfo.h index 1bb7054..8d639a8 100644 --- a/lldb/include/lldb/Target/MemoryRegionInfo.h +++ b/lldb/include/lldb/Target/MemoryRegionInfo.h @@ -121,7 +121,7 @@ public: /// 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> &GetDirtyPageList() const { + const std::optional> &GetDirtyPageList() const { return m_dirty_pages; } @@ -150,7 +150,7 @@ protected: OptionalBool m_memory_tagged = eDontKnow; OptionalBool m_is_stack_memory = eDontKnow; int m_pagesize = 0; - llvm::Optional> m_dirty_pages; + std::optional> 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 953eb32..00543bb 100644 --- a/lldb/include/lldb/Target/MemoryTagMap.h +++ b/lldb/include/lldb/Target/MemoryTagMap.h @@ -67,8 +67,8 @@ public: /// 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> GetTags(lldb::addr_t addr, - size_t len) const; + std::vector> GetTags(lldb::addr_t addr, + size_t len) const; private: /// Lookup the tag for address @@ -80,7 +80,7 @@ private: /// \return /// The tag for the granule that address refers to, or std::nullopt /// if it has no memory tag. - llvm::Optional GetTag(lldb::addr_t addr) const; + std::optional GetTag(lldb::addr_t addr) const; // A map of granule aligned addresses to their memory tag std::map m_addr_to_tag; @@ -88,7 +88,7 @@ private: // 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 allows it to handle + // returning a MemoryTagMap, std::optional 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 37267d9..447fb43 100644 --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/include/lldb/Target/PathMappingList.h @@ -90,8 +90,8 @@ public: /// /// \return /// The remapped filespec that may or may not exist on disk. - llvm::Optional RemapPath(llvm::StringRef path, - bool only_if_exists = false) const; + std::optional 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 @@ public: /// 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 ReverseRemapPath(const FileSpec &file, - FileSpec &fixed) const; + std::optional ReverseRemapPath(const FileSpec &file, + FileSpec &fixed) const; /// Finds a source file given a file spec using the path remappings. /// @@ -124,7 +124,7 @@ public: /// /// \return /// The newly remapped filespec that is guaranteed to exist. - llvm::Optional FindFile(const FileSpec &orig_spec) const; + std::optional 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 c4073b1..08e47cc 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -204,9 +204,9 @@ public: bool SetOSVersion(llvm::VersionTuple os_version); - llvm::Optional GetOSBuildString(); + std::optional GetOSBuildString(); - llvm::Optional GetOSKernelDescription(); + std::optional GetOSKernelDescription(); // Returns the name of the platform llvm::StringRef GetName() { return GetPluginName(); } @@ -232,11 +232,11 @@ public: // HostInfo::GetOSVersion(). virtual bool GetRemoteOSVersion() { return false; } - virtual llvm::Optional GetRemoteOSBuildString() { + virtual std::optional GetRemoteOSBuildString() { return std::nullopt; } - virtual llvm::Optional GetRemoteOSKernelDescription() { + virtual std::optional GetRemoteOSKernelDescription() { return std::nullopt; } diff --git a/lldb/include/lldb/Target/RemoteAwarePlatform.h b/lldb/include/lldb/Target/RemoteAwarePlatform.h index 8354b49..d183815 100644 --- a/lldb/include/lldb/Target/RemoteAwarePlatform.h +++ b/lldb/include/lldb/Target/RemoteAwarePlatform.h @@ -65,8 +65,8 @@ public: FileSpec &local_file) override; bool GetRemoteOSVersion() override; - llvm::Optional GetRemoteOSBuildString() override; - llvm::Optional GetRemoteOSKernelDescription() override; + std::optional GetRemoteOSBuildString() override; + std::optional 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 e14df80..419f0c0 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 GetByteSize() override { + std::optional 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 2be51ac..f672786 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -146,9 +146,9 @@ public: protected: StatsDuration m_create_time; - llvm::Optional m_launch_or_attach_time; - llvm::Optional m_first_private_stop_time; - llvm::Optional m_first_public_stop_time; + std::optional m_launch_or_attach_time; + std::optional m_first_private_stop_time; + std::optional m_first_public_stop_time; StatsSuccessFail m_expr_eval{"expressionEvaluation"}; StatsSuccessFail m_frame_var{"frameVariable"}; std::vector m_module_identifiers; diff --git a/lldb/include/lldb/Target/Trace.h b/lldb/include/lldb/Target/Trace.h index bf6b24f..fc67a0e 100644 --- a/lldb/include/lldb/Target/Trace.h +++ b/lldb/include/lldb/Target/Trace.h @@ -465,19 +465,19 @@ protected: GetLiveProcessBinaryData(llvm::StringRef kind); /// Get the size of the data returned by \a GetLiveThreadBinaryData - llvm::Optional GetLiveThreadBinaryDataSize(lldb::tid_t tid, - llvm::StringRef kind); + std::optional GetLiveThreadBinaryDataSize(lldb::tid_t tid, + llvm::StringRef kind); /// Get the size of the data returned by \a GetLiveCpuBinaryData - llvm::Optional GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id, - llvm::StringRef kind); + std::optional GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id, + llvm::StringRef kind); /// Get the size of the data returned by \a GetLiveProcessBinaryData - llvm::Optional GetLiveProcessBinaryDataSize(llvm::StringRef kind); + std::optional GetLiveProcessBinaryDataSize(llvm::StringRef kind); /// Constructor for post mortem processes Trace(llvm::ArrayRef postmortem_processes, - llvm::Optional> postmortem_cpus); + std::optional> postmortem_cpus); /// Constructor for a live process Trace(Process &live_process) : m_live_process(&live_process) {} @@ -572,7 +572,7 @@ private: /// The list of cpus being traced. Might be \b None depending on the /// plug-in. - llvm::Optional> cpus; + std::optional> 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 @@ private: /// \} - llvm::Optional live_refresh_error; + std::optional 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 576b370..cfc25b0 100644 --- a/lldb/include/lldb/Target/TraceCursor.h +++ b/lldb/include/lldb/Target/TraceCursor.h @@ -271,7 +271,7 @@ public: /// \return /// The approximate wall clock time for the trace item, or \a std::nullopt /// if not available. - virtual llvm::Optional GetWallClockTime() const = 0; + virtual std::optional GetWallClockTime() const = 0; /// Get some metadata associated with a synchronization point event. As /// different trace technologies might have different values for this, diff --git a/lldb/include/lldb/Target/TraceDumper.h b/lldb/include/lldb/Target/TraceDumper.h index 4a8fbf8..72dcf64 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 id = std::nullopt; + std::optional id = std::nullopt; /// Optional number of instructions to skip from the starting position /// of the cursor. - llvm::Optional skip = std::nullopt; + std::optional skip = std::nullopt; }; /// Class used to dump the instructions of a \a TraceCursor using its current @@ -63,13 +63,13 @@ public: struct TraceItem { lldb::user_id_t id; lldb::addr_t load_address; - llvm::Optional timestamp; + std::optional timestamp; std::optional hw_clock; std::optional sync_point_metadata; - llvm::Optional error; - llvm::Optional event; - llvm::Optional symbol_info; - llvm::Optional prev_symbol_info; + std::optional error; + std::optional event; + std::optional symbol_info; + std::optional prev_symbol_info; std::optional cpu_id; }; @@ -350,7 +350,8 @@ public: /// \return /// A optional to the untraced prefix segment of this call. - const llvm::Optional &GetUntracedPrefixSegment() const; + const std::optional & + GetUntracedPrefixSegment() const; /// \return /// A pointer to the parent call. It may be \b nullptr. @@ -360,7 +361,7 @@ public: private: /// An optional untraced segment that precedes all the traced segments. - llvm::Optional m_untraced_prefix_segment; + std::optional 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 m_traced_segments; @@ -413,7 +414,7 @@ public: /// \return /// The instruction id of the last traversed instruction, or \b /// std::nullopt if no instructions were visited. - llvm::Optional DumpInstructions(size_t count); + std::optional 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 52761ae..c996723 100644 --- a/lldb/include/lldb/Target/UnixSignals.h +++ b/lldb/include/lldb/Target/UnixSignals.h @@ -105,9 +105,9 @@ public: // 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 GetFilteredSignals(llvm::Optional should_suppress, - llvm::Optional should_stop, - llvm::Optional should_notify); + std::vector GetFilteredSignals(std::optional should_suppress, + std::optional should_stop, + std::optional 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 f9246f1..225346a 100644 --- a/lldb/include/lldb/Utility/Diagnostics.h +++ b/lldb/include/lldb/Utility/Diagnostics.h @@ -56,7 +56,7 @@ public: static llvm::Expected CreateUniqueDirectory(); private: - static llvm::Optional &InstanceImpl(); + static std::optional &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 b191865..e4d3d12 100644 --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -195,7 +195,7 @@ public: /// 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