Fix PR14625 by teaching the driver to detect PWD for assembly files.

This also requires adding support to -cc1as for passing the detecting
PWD down through LLVM's debug info (which in turn required the LLVM
change in r170371).

The test case is weak (we only test the driver behavior) because there
is currently to infrastructure for running cc1as in the test suite. So
those four lines are untested (much like all other lines in that file),
but we have a test for the same pattern using llvm-mc in the LLVM
repository.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170373 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp
index 87e3bfb..73be56c 100644
--- a/tools/driver/cc1as_main.cpp
+++ b/tools/driver/cc1as_main.cpp
@@ -83,6 +83,7 @@
   unsigned SaveTemporaryLabels : 1;
   unsigned GenDwarfForAssembly : 1;
   std::string DwarfDebugFlags;
+  std::string DebugCompilationDir;
 
   /// @}
   /// @name Frontend Options
@@ -181,6 +182,7 @@
   Opts.SaveTemporaryLabels = Args->hasArg(OPT_L);
   Opts.GenDwarfForAssembly = Args->hasArg(OPT_g);
   Opts.DwarfDebugFlags = Args->getLastArgValue(OPT_dwarf_debug_flags);
+  Opts.DebugCompilationDir = Args->getLastArgValue(OPT_fdebug_compilation_dir);
 
   // Frontend Options
   if (Args->hasArg(OPT_INPUT)) {
@@ -305,6 +307,8 @@
     Ctx.setGenDwarfForAssembly(true);
   if (!Opts.DwarfDebugFlags.empty())
     Ctx.setDwarfDebugFlags(StringRef(Opts.DwarfDebugFlags));
+  if (!Opts.DebugCompilationDir.empty())
+    Ctx.setCompilationDir(Opts.DebugCompilationDir);
 
   // Build up the feature string from the target feature list.
   std::string FS;