diff options
-rw-r--r-- | lib/Driver/Compilation.cpp | 8 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 7 | ||||
-rw-r--r-- | lib/Driver/Tools.h | 3 | ||||
-rw-r--r-- | test/Driver/crash-cleanup.c | 7 |
4 files changed, 20 insertions, 5 deletions
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index d02da9588a..42c84493fa 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -217,8 +217,12 @@ void Compilation::initCompilationForDiagnostics(void) { // Remove any user specified output. Claim any unclaimed arguments, so as // to avoid emitting warnings about unused args. - if (TranslatedArgs->hasArg(options::OPT_o)) - TranslatedArgs->eraseArg(options::OPT_o); + OptSpecifier OutputOpts[] = { options::OPT_o, options::OPT_MD, + options::OPT_MMD }; + for (unsigned i = 0; i != sizeof(OutputOpts)/sizeof(OutputOpts[0]); ++i) { + if (TranslatedArgs->hasArg(OutputOpts[i])) + TranslatedArgs->eraseArg(OutputOpts[i]); + } TranslatedArgs->ClaimAllArgs(); // Redirect stdout/stderr to /dev/null. diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index c4e536079e..7d46793a5f 100644 --- a/lib/Driver/Tools.cpp +++ b/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". diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index a4f732e1c2..d81c987cf0 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -29,7 +29,8 @@ namespace tools { /// \brief Clang compiler tool. class LLVM_LIBRARY_VISIBILITY Clang : public Tool { - void AddPreprocessingOptions(const Driver &D, + void AddPreprocessingOptions(Compilation &C, + const Driver &D, const ArgList &Args, ArgStringList &CmdArgs, const InputInfo &Output, diff --git a/test/Driver/crash-cleanup.c b/test/Driver/crash-cleanup.c new file mode 100644 index 0000000000..d6d9ae0c7c --- /dev/null +++ b/test/Driver/crash-cleanup.c @@ -0,0 +1,7 @@ +// RUN: not %clang -o %t.o -MMD -MF %t.d %s +// RUN: test ! -f %t.o +// RUN: test ! -f %t.d +// REQUIRES: shell +// REQUIRES: crash-recovery + +#pragma clang __debug crash |