From 9b515cb0ec76b0f1b4af77e18630a453ef782e4f Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Sun, 6 Nov 2011 00:40:05 +0000 Subject: Add the depfile as a result file so that it is deleted if we crash, and prevent the diagnostic preprocessor run from writing a depfile. llvm-svn: 143846 --- clang/lib/Driver/Tools.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/lib/Driver/Tools.cpp') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index c4e536079e1..7d46793a5f3 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -203,7 +203,8 @@ static void AddIncludeDirectoryList(const ArgList &Args, } } -void Clang::AddPreprocessingOptions(const Driver &D, +void Clang::AddPreprocessingOptions(Compilation &C, + const Driver &D, const ArgList &Args, ArgStringList &CmdArgs, const InputInfo &Output, @@ -225,11 +226,13 @@ void Clang::AddPreprocessingOptions(const Driver &D, DepFile = Output.getFilename(); } else if (Arg *MF = Args.getLastArg(options::OPT_MF)) { DepFile = MF->getValue(Args); + C.addResultFile(DepFile); } else if (A->getOption().matches(options::OPT_M) || A->getOption().matches(options::OPT_MM)) { DepFile = "-"; } else { DepFile = darwin::CC1::getDependencyFileName(Args, Inputs); + C.addResultFile(DepFile); } CmdArgs.push_back("-dependency-file"); CmdArgs.push_back(DepFile); @@ -1541,7 +1544,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // // FIXME: Support -fpreprocessed if (types::getPreprocessedType(InputType) != types::TY_INVALID) - AddPreprocessingOptions(D, Args, CmdArgs, Output, Inputs); + AddPreprocessingOptions(C, D, Args, CmdArgs, Output, Inputs); // Don't warn about "clang -c -DPIC -fPIC test.i" because libtool.m4 assumes // that "The compiler can only warn and ignore the option if not recognized". -- cgit v1.2.3