[Lldb-commits] [lldb] 6eddd98 - [lldb/Plugin] Use static ScriptedInterface::ErrorWithMessage function (NFC)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 4 13:35:43 PST 2022


Author: Med Ismail Bennani
Date: 2022-03-04T13:35:19-08:00
New Revision: 6eddd987c9c9d2ab76ed53eea452b34145992ed9

URL: https://github.com/llvm/llvm-project/commit/6eddd987c9c9d2ab76ed53eea452b34145992ed9
DIFF: https://github.com/llvm/llvm-project/commit/6eddd987c9c9d2ab76ed53eea452b34145992ed9.diff

LOG: [lldb/Plugin] Use static ScriptedInterface::ErrorWithMessage function (NFC)

This patch replaces the calls to ErrorWithMessage using the GetInterface
message by a call to the static method directly.

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/source/Plugins/Process/scripted/ScriptedThread.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
index 8174a8bde3315..e28f66015dd59 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -121,7 +121,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) {
 
   llvm::Optional<std::string> reg_data = GetInterface()->GetRegisterContext();
   if (!reg_data)
-    return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
+    return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
         LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers data.",
         error, LLDBLog::Thread);
 
@@ -129,7 +129,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) {
       std::make_shared<DataBufferHeap>(reg_data->c_str(), reg_data->size()));
 
   if (!data_sp->GetByteSize())
-    return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
+    return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
         LLVM_PRETTY_FUNCTION, "Failed to copy raw registers data.", error,
         LLDBLog::Thread);
 
@@ -137,7 +137,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) {
       std::make_shared<RegisterContextMemory>(
           *this, 0, *GetDynamicRegisterInfo(), LLDB_INVALID_ADDRESS);
   if (!reg_ctx_memory)
-    return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
+    return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
         LLVM_PRETTY_FUNCTION, "Failed to create a register context.", error,
         LLDBLog::Thread);
 
@@ -152,13 +152,13 @@ bool ScriptedThread::LoadArtificialStackFrames() {
 
   Status error;
   if (!arr_sp)
-    return GetInterface()->ErrorWithMessage<bool>(
+    return ScriptedInterface::ErrorWithMessage<bool>(
         LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stackframes.",
         error, LLDBLog::Thread);
 
   size_t arr_size = arr_sp->GetSize();
   if (arr_size > std::numeric_limits<uint32_t>::max())
-    return GetInterface()->ErrorWithMessage<bool>(
+    return ScriptedInterface::ErrorWithMessage<bool>(
         LLVM_PRETTY_FUNCTION,
         llvm::Twine(
             "StackFrame array size (" + llvm::Twine(arr_size) +
@@ -174,7 +174,7 @@ bool ScriptedThread::LoadArtificialStackFrames() {
     StructuredData::Dictionary *dict;
 
     if (!arr_sp->GetItemAtIndexAsDictionary(idx, dict) || !dict)
-      return GetInterface()->ErrorWithMessage<bool>(
+      return ScriptedInterface::ErrorWithMessage<bool>(
           LLVM_PRETTY_FUNCTION,
           llvm::Twine(
               "Couldn't get artificial stackframe dictionary at index (" +
@@ -203,7 +203,7 @@ bool ScriptedThread::LoadArtificialStackFrames() {
         StackFrame::Kind::Artificial, behaves_like_zeroth_frame, &sc);
 
     if (!frames->SetFrameAtIndex(static_cast<uint32_t>(idx), synth_frame_sp))
-      return GetInterface()->ErrorWithMessage<bool>(
+      return ScriptedInterface::ErrorWithMessage<bool>(
           LLVM_PRETTY_FUNCTION,
           llvm::Twine("Couldn't add frame (" + llvm::Twine(idx) +
                       llvm::Twine(") to ScriptedThread StackFrameList."))
@@ -219,7 +219,7 @@ bool ScriptedThread::CalculateStopInfo() {
 
   Status error;
   if (!dict_sp)
-    return GetInterface()->ErrorWithMessage<bool>(
+    return ScriptedInterface::ErrorWithMessage<bool>(
         LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stop info.", error,
         LLDBLog::Thread);
 
@@ -227,14 +227,14 @@ bool ScriptedThread::CalculateStopInfo() {
   lldb::StopReason stop_reason_type;
 
   if (!dict_sp->GetValueForKeyAsInteger("type", stop_reason_type))
-    return GetInterface()->ErrorWithMessage<bool>(
+    return ScriptedInterface::ErrorWithMessage<bool>(
         LLVM_PRETTY_FUNCTION,
         "Couldn't find value for key 'type' in stop reason dictionary.", error,
         LLDBLog::Thread);
 
   StructuredData::Dictionary *data_dict;
   if (!dict_sp->GetValueForKeyAsDictionary("data", data_dict))
-    return GetInterface()->ErrorWithMessage<bool>(
+    return ScriptedInterface::ErrorWithMessage<bool>(
         LLVM_PRETTY_FUNCTION,
         "Couldn't find value for key 'data' in stop reason dictionary.", error,
         LLDBLog::Thread);
@@ -266,7 +266,7 @@ bool ScriptedThread::CalculateStopInfo() {
         StopInfo::CreateStopReasonWithException(*this, description.data());
   } break;
   default:
-    return GetInterface()->ErrorWithMessage<bool>(
+    return ScriptedInterface::ErrorWithMessage<bool>(
         LLVM_PRETTY_FUNCTION,
         llvm::Twine("Unsupported stop reason type (" +
                     llvm::Twine(stop_reason_type) + llvm::Twine(")."))


        


More information about the lldb-commits mailing list