diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 82f46469df61..fecfbf5077da 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -627,7 +627,7 @@ public: /// \return \b true if the session transcript was successfully written to /// disk, \b false otherwise. bool SaveTranscript(CommandReturnObject &result, - llvm::Optional output_file = std::nullopt); + std::optional output_file = std::nullopt); FileSpec GetCurrentSourceDir(); diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 180ff9cb9ed5..4aee2e48a13c 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3191,7 +3191,7 @@ bool CommandInterpreter::IOHandlerInterrupt(IOHandler &io_handler) { } bool CommandInterpreter::SaveTranscript( - CommandReturnObject &result, llvm::Optional output_file) { + CommandReturnObject &result, std::optional output_file) { if (output_file == std::nullopt || output_file->empty()) { std::string now = llvm::to_string(std::chrono::system_clock::now()); std::replace(now.begin(), now.end(), ' ', '_'); diff --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp index 66ef90fa96a9..f0e4d0e07114 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp @@ -65,8 +65,8 @@ Error IntelPTCollector::TraceStop(const TraceStopRequest &request) { /// \return /// some file descriptor in /sys/fs/ associated with the cgroup of the given /// pid, or \a std::nullopt if the pid is not part of a cgroup. -static Optional GetCGroupFileDescriptor(lldb::pid_t pid) { - static Optional fd; +static std::optional GetCGroupFileDescriptor(lldb::pid_t pid) { + static std::optional fd; if (fd) return fd; @@ -119,7 +119,7 @@ Error IntelPTCollector::TraceStart(const TraceIntelPTStartRequest &request) { effective_request.enable_tsc = true; // We try to use cgroup filtering whenever possible - Optional cgroup_fd; + std::optional cgroup_fd; if (!request.disable_cgroup_filtering.value_or(false)) cgroup_fd = GetCGroupFileDescriptor(m_process.GetID()); diff --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp index 0453de25faf4..cc7f91f3e1dd 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp @@ -35,7 +35,7 @@ static Error IncludePerfEventParanoidMessageInError(Error &&error) { Expected> IntelPTMultiCoreTrace::StartOnAllCores(const TraceIntelPTStartRequest &request, NativeProcessProtocol &process, - Optional cgroup_fd) { + std::optional cgroup_fd) { Expected> cpu_ids = GetAvailableLogicalCoreIDs(); if (!cpu_ids) return cpu_ids.takeError(); diff --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h index b5b420335b43..1f042c63f134 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h +++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h @@ -43,7 +43,7 @@ public: static llvm::Expected> StartOnAllCores(const TraceIntelPTStartRequest &request, NativeProcessProtocol &process, - llvm::Optional cgroup_fd = std::nullopt); + std::optional cgroup_fd = std::nullopt); /// Execute the provided callback on each core that is being traced. /// diff --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp index 36ee0260d3d2..f64f29f81f0a 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp @@ -228,9 +228,11 @@ Expected> IntelPTSingleBufferTrace::GetIptTrace() { return m_perf_event.GetReadOnlyAuxBuffer(); } -Expected IntelPTSingleBufferTrace::Start( - const TraceIntelPTStartRequest &request, Optional tid, - Optional cpu_id, bool disabled, Optional cgroup_fd) { +Expected +IntelPTSingleBufferTrace::Start(const TraceIntelPTStartRequest &request, + std::optional tid, + std::optional cpu_id, bool disabled, + std::optional cgroup_fd) { #ifndef PERF_ATTR_SIZE_VER5 return createStringError(inconvertibleErrorCode(), "Intel PT Linux perf event not supported"); diff --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h index a61e35b08c34..9427e1ea196b 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h +++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h @@ -50,10 +50,9 @@ public: /// A \a IntelPTSingleBufferTrace instance if tracing was successful, or /// an \a llvm::Error otherwise. static llvm::Expected - Start(const TraceIntelPTStartRequest &request, - llvm::Optional tid, - llvm::Optional cpu_id = std::nullopt, - bool disabled = false, llvm::Optional cgroup_fd = std::nullopt); + Start(const TraceIntelPTStartRequest &request, std::optional tid, + std::optional cpu_id = std::nullopt, + bool disabled = false, std::optional cgroup_fd = std::nullopt); /// \return /// The bytes requested by a jLLDBTraceGetBinaryData packet that was routed diff --git a/lldb/source/Plugins/Process/Linux/Perf.cpp b/lldb/source/Plugins/Process/Linux/Perf.cpp index a3095c8c103b..0179455a68d4 100644 --- a/lldb/source/Plugins/Process/Linux/Perf.cpp +++ b/lldb/source/Plugins/Process/Linux/Perf.cpp @@ -76,9 +76,9 @@ void resource_handle::FileDescriptorDeleter::operator()(long *ptr) { } llvm::Expected PerfEvent::Init(perf_event_attr &attr, - Optional pid, - Optional cpu, - Optional group_fd, + std::optional pid, + std::optional cpu, + std::optional group_fd, unsigned long flags) { errno = 0; long fd = syscall(SYS_perf_event_open, &attr, pid.value_or(-1), @@ -92,8 +92,8 @@ llvm::Expected PerfEvent::Init(perf_event_attr &attr, } llvm::Expected PerfEvent::Init(perf_event_attr &attr, - Optional pid, - Optional cpu) { + std::optional pid, + std::optional cpu) { return Init(attr, pid, cpu, -1, 0); } @@ -362,7 +362,7 @@ lldb_private::process_linux::CreateContextSwitchTracePerfEvent( LLDB_LOG(log, "Will create context switch trace buffer of size {0}", data_buffer_size); - Optional group_fd; + std::optional group_fd; if (parent_perf_event) group_fd = parent_perf_event->GetFd(); diff --git a/lldb/source/Plugins/Process/Linux/Perf.h b/lldb/source/Plugins/Process/Linux/Perf.h index fb3fd244664f..3f326212cdec 100644 --- a/lldb/source/Plugins/Process/Linux/Perf.h +++ b/lldb/source/Plugins/Process/Linux/Perf.h @@ -107,9 +107,9 @@ public: /// If the perf_event_open syscall was successful, a minimal \a PerfEvent /// instance, or an \a llvm::Error otherwise. static llvm::Expected Init(perf_event_attr &attr, - llvm::Optional pid, - llvm::Optional cpu, - llvm::Optional group_fd, + std::optional pid, + std::optional cpu, + std::optional group_fd, unsigned long flags); /// Create a new performance monitoring event via the perf_event_open syscall @@ -125,8 +125,8 @@ public: /// The process or thread to be monitored by the event. If \b None, then /// all threads and processes are monitored. static llvm::Expected - Init(perf_event_attr &attr, llvm::Optional pid, - llvm::Optional core = std::nullopt); + Init(perf_event_attr &attr, std::optional pid, + std::optional core = std::nullopt); /// Mmap the metadata page and the data and aux buffers of the perf event and /// expose them through \a PerfEvent::GetMetadataPage() , \a