summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-11-02 22:34:51 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-11-02 22:34:51 +0000
commit50bc1ed290824218a1bb46f70ec731712da610b0 (patch)
tree1d3e18cd42de622121b266b93322ec7d6e6c4507 /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
parentd1932dcdd3e3212ad6ad21f586cfa8a44940b8f9 (diff)
downloadbcm5719-llvm-50bc1ed290824218a1bb46f70ec731712da610b0.tar.gz
bcm5719-llvm-50bc1ed290824218a1bb46f70ec731712da610b0.zip
[FileSystem] Open File instances through the FileSystem.
This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 llvm-svn: 346049
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 7e6a950cea4..26fec938838 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -2756,8 +2756,12 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,
// Check we can create writable file
FileSpec file_spec(path);
FileSystem::Instance().Resolve(file_spec);
- File file(file_spec, File::eOpenOptionWrite | File::eOpenOptionCanCreate |
- File::eOpenOptionTruncate);
+ File file;
+ FileSystem::Instance().Open(file, file_spec,
+ File::eOpenOptionWrite |
+ File::eOpenOptionCanCreate |
+ File::eOpenOptionTruncate);
+
if (!file) {
strm.Printf("Error: Failed to open '%s' for writing", path);
strm.EOL();
@@ -4710,16 +4714,17 @@ public:
m_options.m_outfile; // Dump allocation to file instead
if (outfile_spec) {
// Open output file
- char path[256];
- outfile_spec.GetPath(path, sizeof(path));
- if (outfile_stream.GetFile()
- .Open(path, File::eOpenOptionWrite | File::eOpenOptionCanCreate)
- .Success()) {
+ std::string path = outfile_spec.GetPath();
+ auto error = FileSystem::Instance().Open(
+ outfile_stream.GetFile(), outfile_spec,
+ File::eOpenOptionWrite | File::eOpenOptionCanCreate);
+ if (error.Success()) {
output_strm = &outfile_stream;
- result.GetOutputStream().Printf("Results written to '%s'", path);
+ result.GetOutputStream().Printf("Results written to '%s'",
+ path.c_str());
result.GetOutputStream().EOL();
} else {
- result.AppendErrorWithFormat("Couldn't open file '%s'", path);
+ result.AppendErrorWithFormat("Couldn't open file '%s'", path.c_str());
result.SetStatus(eReturnStatusFailed);
return false;
}
OpenPOWER on IntegriCloud