From 2fce1137c7c227f40edbb657c484797addba38ca Mon Sep 17 00:00:00 2001 From: Lawrence D'Anna Date: Thu, 26 Sep 2019 17:54:59 +0000 Subject: Convert FileSystem::Open() to return Expected Summary: This patch converts FileSystem::Open from this prototype: Status Open(File &File, const FileSpec &file_spec, ...); to this one: llvm::Expected> Open(const FileSpec &file_spec, ...); This is beneficial on its own, as llvm::Expected is a more modern and recommended error type than Status. It is also a necessary step towards https://reviews.llvm.org/D67891, and further developments for lldb_private::File. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67996 llvm-svn: 373003 --- .../ScriptInterpreter/Python/PythonDataObjectsTests.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp') diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp index d43da010b1d..e6d1c4d14b0 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp @@ -15,6 +15,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/lldb-enumerations.h" +#include "llvm/Testing/Support/Error.h" #include "PythonTestSuite.h" @@ -581,10 +582,10 @@ TEST_F(PythonDataObjectsTest, TestPythonCallableInvoke) { } TEST_F(PythonDataObjectsTest, TestPythonFile) { - File file; - FileSystem::Instance().Open(file, FileSpec(FileSystem::DEV_NULL), - File::eOpenOptionRead); - PythonFile py_file(file, "r"); + auto file = FileSystem::Instance().Open(FileSpec(FileSystem::DEV_NULL), + File::eOpenOptionRead); + ASSERT_THAT_EXPECTED(file, llvm::Succeeded()); + PythonFile py_file(*file.get(), "r"); EXPECT_TRUE(PythonFile::Check(py_file.get())); } -- cgit v1.2.3