summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-11-21 00:01:05 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-11-21 00:01:05 +0000
commit119cfaa5957d4a27b3dba543bc77638459fbdb92 (patch)
tree9ff9b410e7deaf93fe773694be378a4fcdbb1dff /clang/lib
parent17a7bbbc9f069ebf4c9f06df70965fbd336d4e12 (diff)
downloadbcm5719-llvm-119cfaa5957d4a27b3dba543bc77638459fbdb92.tar.gz
bcm5719-llvm-119cfaa5957d4a27b3dba543bc77638459fbdb92.zip
Teach the driver about failure result files, which are compilation
output files that are valid regardless of whether the compilation succeeded or failed (but not if we crash). Add depfiles to the failure result file list. llvm-svn: 145018
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