|
@@ -45,6 +45,11 @@ Compilation::Compilation(const Driver &D, const ToolChain &_DefaultToolChain,
|
|
}
|
|
}
|
|
|
|
|
|
Compilation::~Compilation() {
|
|
Compilation::~Compilation() {
|
|
|
|
+ // Remove temporary files. This must be done before arguments are freed, as
|
|
|
|
+ // the file names might be derived from the input arguments.
|
|
|
|
+ if (!TheDriver.isSaveTempsEnabled() && !ForceKeepTempFiles)
|
|
|
|
+ CleanupFileList(TempFiles);
|
|
|
|
+
|
|
delete TranslatedArgs;
|
|
delete TranslatedArgs;
|
|
delete Args;
|
|
delete Args;
|
|
|
|
|
|
@@ -245,6 +250,10 @@ void Compilation::initCompilationForDiagnostics() {
|
|
AllActions.clear();
|
|
AllActions.clear();
|
|
Jobs.clear();
|
|
Jobs.clear();
|
|
|
|
|
|
|
|
+ // Remove temporary files.
|
|
|
|
+ if (!TheDriver.isSaveTempsEnabled() && !ForceKeepTempFiles)
|
|
|
|
+ CleanupFileList(TempFiles);
|
|
|
|
+
|
|
// Clear temporary/results file lists.
|
|
// Clear temporary/results file lists.
|
|
TempFiles.clear();
|
|
TempFiles.clear();
|
|
ResultFiles.clear();
|
|
ResultFiles.clear();
|
|
@@ -262,6 +271,9 @@ void Compilation::initCompilationForDiagnostics() {
|
|
|
|
|
|
// Redirect stdout/stderr to /dev/null.
|
|
// Redirect stdout/stderr to /dev/null.
|
|
Redirects = {None, {""}, {""}};
|
|
Redirects = {None, {""}, {""}};
|
|
|
|
+
|
|
|
|
+ // Temporary files added by diagnostics should be kept.
|
|
|
|
+ ForceKeepTempFiles = true;
|
|
}
|
|
}
|
|
|
|
|
|
StringRef Compilation::getSysRoot() const {
|
|
StringRef Compilation::getSysRoot() const {
|