[Lldb-commits] [lldb] cf02d8b - [lldb] Store ECError as CloneableECError in Status

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 18 16:25:27 PDT 2024


Author: Adrian Prantl
Date: 2024-09-18T16:23:29-07:00
New Revision: cf02d8bbb6dfed17081fbdbf44e2071aea1af728

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

LOG: [lldb] Store ECError as CloneableECError in Status

Added: 
    

Modified: 
    lldb/source/Utility/Status.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index f557cb540b5655..a659456b9b1b39 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -144,13 +144,19 @@ static llvm::Error CloneError(const llvm::Error &error) {
     return llvm::make_error<llvm::StringError>(e.message(),
                                                e.convertToErrorCode(), true);
   };
-  visitErrors(error, [&](const llvm::ErrorInfoBase &e) {
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &e) {
     result = joinErrors(std::move(result), clone(e));
   });
   return result;
 }
 
-Status Status::FromError(llvm::Error error) { return Status(std::move(error)); }
+Status Status::FromError(llvm::Error error) {
+  if (error.isA<llvm::ECError>()) {
+    std::error_code ec = llvm::errorToErrorCode(std::move(error));
+    return Status::FromError(llvm::make_error<CloneableECError>(ec));
+  }
+  return Status(std::move(error));
+}
 
 llvm::Error Status::ToError() const { return CloneError(m_error); }
 


        


More information about the lldb-commits mailing list