Hi jasonmolenda,

mkstemp doesn't exist on Windows.  A function is provided by LLVM support 
libraries for this reason, so use that instead.

http://reviews.llvm.org/D5849

Files:
  source/Expression/ClangExpressionParser.cpp
Index: source/Expression/ClangExpressionParser.cpp
===================================================================
--- source/Expression/ClangExpressionParser.cpp
+++ source/Expression/ClangExpressionParser.cpp
@@ -301,18 +301,19 @@
     {
         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 @@
                 {
                     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;
                 }
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to