diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h index 5c4bbc46400f..cc03a1fbb621 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h @@ -102,7 +102,7 @@ private: std::string m_stop_description; using WatchpointIndexMap = std::map; WatchpointIndexMap m_watchpoint_index_map; - llvm::Optional m_step_workaround; + std::unique_ptr m_step_workaround; }; typedef std::shared_ptr NativeThreadLinuxSP; diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp index de95ca0ceb4b..48943d6ac936 100644 --- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp @@ -139,13 +139,13 @@ bool WorkaroundNeeded() { } // end anonymous namespace -llvm::Optional SingleStepWorkaround::Get(::pid_t tid) { +std::unique_ptr SingleStepWorkaround::Get(::pid_t tid) { Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); static bool workaround_needed = WorkaroundNeeded(); if (!workaround_needed) { LLDB_LOG(log, "workaround for thread {0} not needed", tid); - return llvm::None; + return nullptr; } cpu_set_t original_set; @@ -153,7 +153,7 @@ llvm::Optional SingleStepWorkaround::Get(::pid_t tid) { // This should really not fail. But, just in case... LLDB_LOG(log, "Unable to get cpu affinity for thread {0}: {1}", tid, Error(errno, eErrorTypePOSIX)); - return llvm::None; + return nullptr; } cpu_set_t set; @@ -168,7 +168,7 @@ llvm::Optional SingleStepWorkaround::Get(::pid_t tid) { } LLDB_LOG(log, "workaround for thread {0} prepared", tid); - return SingleStepWorkaround(tid, original_set); + return llvm::make_unique(tid, original_set); } SingleStepWorkaround::~SingleStepWorkaround() { diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.h b/lldb/source/Plugins/Process/Linux/SingleStepCheck.h index b8d4fab92cf0..afeda7310349 100644 --- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.h +++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.h @@ -10,8 +10,8 @@ #ifndef liblldb_SingleStepCheck_H_ #define liblldb_SingleStepCheck_H_ -#include "sched.h" -#include "llvm/ADT/Optional.h" +#include +#include #include namespace lldb_private { @@ -32,18 +32,21 @@ class SingleStepWorkaround { ::pid_t m_tid; cpu_set_t m_original_set; + SingleStepWorkaround(const SingleStepWorkaround &) = delete; + void operator=(const SingleStepWorkaround &) = delete; + public: SingleStepWorkaround(::pid_t tid, cpu_set_t original_set) : m_tid(tid), m_original_set(original_set) {} ~SingleStepWorkaround(); - static llvm::Optional Get(::pid_t tid); + static std::unique_ptr Get(::pid_t tid); }; #else class SingleStepWorkaround { public: - static llvm::Optional Get(::pid_t tid) { - return llvm::None; + static std::unique_ptr Get(::pid_t tid) { + return nullptr; } }; #endif