[Driver] Fix -working-directory issues
authorMichael J. Spencer <bigcheesegs@gmail.com>
Tue, 28 May 2019 22:21:47 +0000 (22:21 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Tue, 28 May 2019 22:21:47 +0000 (22:21 +0000)
commit7e48b406ef5ef2208c75874f7751a786e748706f
treea1ee1547fa1b66a68a4de8db9df3fc8845b5e259
parent551465859113a609e72b8de907f8977ff28c234a
[Driver] Fix -working-directory issues

Currently the `-working-directory` option does not actually impact the working
directory for all of the clang driver, it only impacts how files are looked up
to make sure they exist.  This means that that clang passes the wrong paths
to -fdebug-compilation-dir and -coverage-notes-file.

This patch fixes that by changing all the places in the driver where we convert
to absolute paths to use the VFS, and then calling setCurrentWorkingDirectory on
the VFS.  This also changes the default VFS for `Driver` to use a virtualized
working directory, instead of changing the process's working directory.

Differential Revision: https://reviews.llvm.org/D62271

llvm-svn: 361885
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/working-directory.c