[llvm-commits] [llvm] r148211 - in /llvm/trunk: include/llvm/Support/Process.h lib/Support/Unix/Process.inc lib/Support/Windows/Process.inc

Chandler Carruth chandlerc at gmail.com
Sun Jan 15 00:41:36 PST 2012


Author: chandlerc
Date: Sun Jan 15 02:41:35 2012
New Revision: 148211

URL: http://llvm.org/viewvc/llvm-project?rev=148211&view=rev
Log:
Remove SetWorkingDirectory from the Process interface. Nothing in LLVM
or Clang is using this, and it would be hard to use it correctly given
the thread hostility of the function. Also, it never checked the return
which is rather dangerous with chdir. If someone was in fact using this,
please let me know, as well as what the usecase actually is so that
I can add it back and make it more correct and secure to use. (That
said, it's never going to be "safe" per-se, but we could at least
document the risks...)

Modified:
    llvm/trunk/include/llvm/Support/Process.h
    llvm/trunk/lib/Support/Unix/Process.inc
    llvm/trunk/lib/Support/Windows/Process.inc

Modified: llvm/trunk/include/llvm/Support/Process.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Process.h?rev=148211&r1=148210&r2=148211&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Process.h (original)
+++ llvm/trunk/include/llvm/Support/Process.h Sun Jan 15 02:41:35 2012
@@ -138,9 +138,6 @@
 
       /// Resets the terminals colors, or returns an escape sequence to do so.
       static const char *ResetColor();
-
-      /// Change the program working directory to that given by \arg Path.
-      static void SetWorkingDirectory(std::string Path);
     /// @}
   };
 }

Modified: llvm/trunk/lib/Support/Unix/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Process.inc?rev=148211&r1=148210&r2=148211&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Process.inc (original)
+++ llvm/trunk/lib/Support/Unix/Process.inc Sun Jan 15 02:41:35 2012
@@ -293,7 +293,3 @@
 const char *Process::ResetColor() {
   return "\033[0m";
 }
-
-void Process::SetWorkingDirectory(std::string Path) {
-  ::chdir(Path.c_str());
-}

Modified: llvm/trunk/lib/Support/Windows/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Process.inc?rev=148211&r1=148210&r2=148211&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Process.inc (original)
+++ llvm/trunk/lib/Support/Windows/Process.inc Sun Jan 15 02:41:35 2012
@@ -220,8 +220,4 @@
   return 0;
 }
 
-void Process::SetWorkingDirectory(std::string Path) {
-  ::_chdir(Path.c_str());
-}
-
 }





More information about the llvm-commits mailing list