Skip to content

Commit e573eb4

Browse files
adrian-prantltmsri
authored andcommitted
[lldb] Store ECError as CloneableECError in Status
1 parent 7ed78a3 commit e573eb4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lldb/source/Utility/Status.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,19 @@ static llvm::Error CloneError(const llvm::Error &error) {
144144
return llvm::make_error<llvm::StringError>(e.message(),
145145
e.convertToErrorCode(), true);
146146
};
147-
visitErrors(error, [&](const llvm::ErrorInfoBase &e) {
147+
llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &e) {
148148
result = joinErrors(std::move(result), clone(e));
149149
});
150150
return result;
151151
}
152152

153-
Status Status::FromError(llvm::Error error) { return Status(std::move(error)); }
153+
Status Status::FromError(llvm::Error error) {
154+
if (error.isA<llvm::ECError>()) {
155+
std::error_code ec = llvm::errorToErrorCode(std::move(error));
156+
return Status::FromError(llvm::make_error<CloneableECError>(ec));
157+
}
158+
return Status(std::move(error));
159+
}
154160

155161
llvm::Error Status::ToError() const { return CloneError(m_error); }
156162

0 commit comments

Comments
 (0)