summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-10-17 00:01:57 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-10-17 00:01:57 +0000
commitb2575da9aa3f759206bf762ad2ceb7fc1946f0f6 (patch)
treeb34ee98cf6cb96969676ca3c94568c78c962e37b /lldb/source/Commands
parent27ef81cd484bae8382ed4b68b43a1d5d28d24cb0 (diff)
downloadbcm5719-llvm-b2575da9aa3f759206bf762ad2ceb7fc1946f0f6.tar.gz
bcm5719-llvm-b2575da9aa3f759206bf762ad2ceb7fc1946f0f6.zip
[Reproducer] Add LoadBuffer<> helper (NFC)
Introduce a helper method named LoadBuffer in the Loader to abstract reading a reproducer file from disk. llvm-svn: 375060
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectReproducer.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp
index 424595fc0bd..0c2e95d5d21 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -265,19 +265,12 @@ protected:
return true;
}
case eReproducerProviderVersion: {
- FileSpec version_file = loader->GetFile<VersionProvider::Info>();
-
- // Load the version info into a buffer.
- ErrorOr<std::unique_ptr<MemoryBuffer>> buffer =
- vfs::getRealFileSystem()->getBufferForFile(version_file.GetPath());
- if (!buffer) {
- SetError(result, errorCodeToError(buffer.getError()));
+ Expected<std::string> version = loader->LoadBuffer<VersionProvider>();
+ if (!version) {
+ SetError(result, version.takeError());
return false;
}
-
- // Return the version string.
- StringRef version = (*buffer)->getBuffer();
- result.AppendMessage(version.str());
+ result.AppendMessage(*version);
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
OpenPOWER on IntegriCloud