[Lldb-commits] [lldb] r220218 - Don't use mkstemp, as it doesn't exist on Windows.
Zachary Turner
zturner at google.com
Mon Oct 20 10:46:56 PDT 2014
Author: zturner
Date: Mon Oct 20 12:46:56 2014
New Revision: 220218
URL: http://llvm.org/viewvc/llvm-project?rev=220218&view=rev
Log:
Don't use mkstemp, as it doesn't exist on Windows.
Differential Revision: http://reviews.llvm.org/D5849
Reviewed by: Jason Molenda
Modified:
lldb/trunk/source/Expression/ClangExpressionParser.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=220218&r1=220217&r2=220218&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Mon Oct 20 12:46:56 2014
@@ -301,18 +301,19 @@ ClangExpressionParser::Parse (Stream &st
{
std::string temp_source_path;
+ int temp_fd = -1;
+ llvm::SmallString<PATH_MAX> result_path;
FileSpec tmpdir_file_spec;
if (HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
{
- tmpdir_file_spec.AppendPathComponent("expr.XXXXXX");
+ tmpdir_file_spec.AppendPathComponent("lldb-%%%%%%.expr");
temp_source_path = std::move(tmpdir_file_spec.GetPath());
+ llvm::sys::fs::createUniqueFile(temp_source_path, temp_fd, result_path);
}
else
{
- temp_source_path = "/tmp/expr.XXXXXX";
+ llvm::sys::fs::createTemporaryFile("lldb", "expr", temp_fd, result_path);
}
-
- int temp_fd = ::mkstemp(&temp_source_path[0]);
if (temp_fd != -1)
{
@@ -325,7 +326,7 @@ ClangExpressionParser::Parse (Stream &st
{
file.Close();
SourceMgr.setMainFileID(SourceMgr.createFileID(
- m_file_manager->getFile(temp_source_path),
+ m_file_manager->getFile(result_path),
SourceLocation(), SrcMgr::C_User));
created_main_file = true;
}
More information about the lldb-commits
mailing list