<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 23, 2011, at 1:33 PM, Daniel Dunbar wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: ddunbar<br>Date: Fri Sep 23 15:33:41 2011<br>New Revision: 140409<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=140409&view=rev">http://llvm.org/viewvc/llvm-project?rev=140409&view=rev</a><br>Log:<br>Driver: Add a --working-directory option which can be used to cause the compiler<br>to operate "as if" in a certain working directory.<br> - For now, we just implement this by changing the actual working directory, but<br>   eventually we would want to handle this transparently. This is useful to<br>   avoid an extra exec() pair in some situations, and will be something we would<br>   want to support for more flexibility in using the Clang libraries.<br><br>Modified:<br>    cfe/trunk/docs/tools/clang.pod<br>    cfe/trunk/include/clang/Driver/Options.td<br>    cfe/trunk/lib/Driver/Driver.cpp<br><br>Modified: cfe/trunk/docs/tools/clang.pod<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/clang.pod?rev=140409&r1=140408&r2=140409&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/clang.pod?rev=140409&r1=140408&r2=140409&view=diff</a><br>==============================================================================<br>--- cfe/trunk/docs/tools/clang.pod (original)<br>+++ cfe/trunk/docs/tools/clang.pod Fri Sep 23 15:33:41 2011<br>@@ -407,6 +407,13 @@<br><br> Show commands to run and use verbose output.<br><br>+=item B<--working-directory><br>+<br>+Use the given argument as the effective working directory to run the compiler<br>+in. This is useful for running the compiler as if in a specific working<br>+directory without the overhead of having to change directory using an auxiliary<br>+process.<br>+<br> =back<br><br><br><br>Modified: cfe/trunk/include/clang/Driver/Options.td<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=140409&r1=140408&r2=140409&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=140409&r1=140408&r2=140409&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Driver/Options.td (original)<br>+++ cfe/trunk/include/clang/Driver/Options.td Fri Sep 23 15:33:41 2011<br>@@ -855,6 +855,8 @@<br> def _version : Flag<"--version">;<br> def _warn__EQ : Joined<"--warn-=">, Alias<W_Joined>;<br> def _warn_ : Joined<"--warn-">, Alias<W_Joined>;<br>+def _working_directory : Separate<"--working-directory">,<br>+    HelpText<"Use the given argument as the effective working directory">;<br> def _write_dependencies : Flag<"--write-dependencies">, Alias<MD>;<br> def _write_user_dependencies : Flag<"--write-user-dependencies">, Alias<MMD>;<br> def _ : Joined<"--">, Flags<[Unsupported]>;<br></div></blockquote><div><br></div><div>Err… why not make use of the existing option?</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">def working_directory : Separate<"-working-directory">,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">  HelpText<"Resolve file paths relative to the specified directory">;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">def working_directory_EQ : Joined<"-working-directory=">,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">  Alias<working_directory>;</div><div><br></div><div>Introduced in r118203, this teaches the various FileManagers and such to use an alternate working directory.</div></div></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><br></body></html>