diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -620,7 +620,11 @@ const llvm::vfs::FileSystem &VFS) { if (Arg *A = Args.getLastArg(options::OPT_ffile_compilation_dir_EQ, options::OPT_fdebug_compilation_dir_EQ)) { - A->render(Args, CmdArgs); + if (A->getOption().matches(options::OPT_ffile_compilation_dir_EQ)) + CmdArgs.push_back(Args.MakeArgString(Twine("-fdebug-compilation-dir=") + + A->getValue())); + else + A->render(Args, CmdArgs); } else if (llvm::ErrorOr CWD = VFS.getCurrentWorkingDirectory()) { CmdArgs.push_back(Args.MakeArgString("-fdebug-compilation-dir=" + *CWD)); @@ -862,10 +866,14 @@ if (Arg *A = Args.getLastArg(options::OPT_ffile_compilation_dir_EQ, options::OPT_fcoverage_compilation_dir_EQ)) { - A->render(Args, CmdArgs); + if (A->getOption().matches(options::OPT_ffile_compilation_dir_EQ)) + CmdArgs.push_back(Args.MakeArgString( + Twine("-fcoverage-compilation-dir=") + A->getValue())); + else + A->render(Args, CmdArgs); } else if (llvm::ErrorOr CWD = D.getVFS().getCurrentWorkingDirectory()) { - Args.MakeArgString("-fcoverage-compilation-dir=" + *CWD); + CmdArgs.push_back(Args.MakeArgString("-fcoverage-compilation-dir=" + *CWD)); } if (Args.hasArg(options::OPT_fprofile_exclude_files_EQ)) {