summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Driver.cpp7
-rw-r--r--clang/lib/Driver/Tools.cpp2
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index feeeb049f55..086e3a411f3 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -507,9 +507,14 @@ int Driver::ExecuteCompilation(const Compilation &C,
return Res;
// Otherwise, remove result files as well.
- if (!C.getArgs().hasArg(options::OPT_save_temps))
+ if (!C.getArgs().hasArg(options::OPT_save_temps)) {
C.CleanupFileList(C.getResultFiles(), true);
+ // Failure result files are valid unless we crashed.
+ if (Res < 0)
+ C.CleanupFileList(C.getFailureResultFiles(), true);
+ }
+
// Print extra information about abnormal failures, if possible.
//
// This is ad-hoc, but we don't want to be excessively noisy. If the result
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 906f2ae0db7..161001ccdbd 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -218,11 +218,13 @@ void Clang::AddPreprocessingOptions(Compilation &C,
DepFile = Output.getFilename();
} else if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
DepFile = MF->getValue(Args);
+ C.addFailureResultFile(DepFile);
} else if (A->getOption().matches(options::OPT_M) ||
A->getOption().matches(options::OPT_MM)) {
DepFile = "-";
} else {
DepFile = darwin::CC1::getDependencyFileName(Args, Inputs);
+ C.addFailureResultFile(DepFile);
}
CmdArgs.push_back("-dependency-file");
CmdArgs.push_back(DepFile);
OpenPOWER on IntegriCloud