[cfe-dev] clangDriver GetTemporaryPath not correct in windows

ether zhhb etherzhhb at gmail.com
Mon Apr 20 00:39:58 PDT 2009


hi,

In llvm/tools/clang/lib/Driver/Driver.cpp at line 1113, the statement
llvm::sys::Path P("/tmp/cc"); will create an invalid temporary path in
windows, and there is a "fix me" comment too :)

So we just simply replace it by "llvm::sys::Path P =
llvm::sys::Path::GetTemporaryDirectory();", is that right? if so, here
is the patch:

--- C:\DOCUME~1\ether\LOCALS~1\Temp\Driver.cpp-revBASE.svn000.tmp.cpp
+++ F:\llvm\tools\clang\lib\Driver\Driver.cpp
@@ -1107,10 +1107,8 @@
 }

 std::string Driver::GetTemporaryPath(const char *Suffix) const {
-  // FIXME: This is lame; sys::Path should provide this function (in
-  // particular, it should know how to find the temporary files dir).
   std::string Error;
-  llvm::sys::Path P("/tmp/cc");
+  llvm::sys::Path P = llvm::sys::Path::GetTemporaryDirectory();
   if (P.makeUnique(false, &Error)) {
     Diag(clang::diag::err_drv_unable_to_make_temp) << Error;
     return "";

by the way, there is another error occur while executing clang with
the message ": error: unable to execute command: program not
executable".

i will try to fix it.

--
ether
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Driver.diff
Type: application/octet-stream
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090420/b4221e20/attachment.obj>


More information about the cfe-dev mailing list