Driver: Result files shouldn't be removed on failure when -save-temps
is specified.
- No easy way to make a safe test case for this (given where the
driver is supposed to put temp files).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67632 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp
index a2fc921..2165bb7 100644
--- a/lib/Driver/Compilation.cpp
+++ b/lib/Driver/Compilation.cpp
@@ -170,7 +170,7 @@
CleanupFileList(TempFiles);
// If the compilation failed, remove result files as well.
- if (Res != 0)
+ if (Res != 0 && !getArgs().hasArg(options::OPT_save_temps))
CleanupFileList(ResultFiles, true);
return Res;