In addition to Doug's concerns which I share (chdir seems *really* heavy handed inside the driver...) I have some more basic technical problems here.
On Fri, Sep 23, 2011 at 1:33 PM, Daniel Dunbar <[email protected]> wrote: > + // Honor --working-directory. Eventually we want to handle this > completely > + // internally to support good use as a library, but for now we just > change our > + // working directory. > + if (const Arg *A = Args->getLastArg(options::OPT__working_directory)) { > + ::chdir(A->getValue(*Args)); > Why aren't you checking this for errors?? As a result of this not being checked, the test (which isn't in this commit? please put test cases in the same commit when possible, it makes it harder to review patches) doesn't actually test anything: % cat tools/clang/test/Driver/Output/working-directory.c.script touch .../build/tools/clang/test/Driver/Output/working-directory.c.tmp.h && echo '#include ".../build/tools/clang/test/Driver/Output/working-directory.c.tmp.h"' > .../build/tools/clang/test/Driver/Output/working-directory.c.tmp.c && .../build/bin/./clang --working-directory .../build/tools/clang/test/Driver/Output/working-directory.c.tmp -fsyntax-only .../build/tools/clang/test/Driver/Output/working-directory.c.tmp.c (paths munged for readability, but '...' is an absolute path) 'working-directory.c.tmp' is a non-existent file, its not a directory at all. Also, the include uses an absolute path, and the clang commandline does too, this test would pass with Clang run from *any* working directory... I think you want to have a source file in the Input subdirectory, and run the compile with a relative path to that file, and a working directory inside the Input subdirectory.
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
