From: Benjamin Kramer Date: Sun, 14 Oct 2012 19:21:21 +0000 (+0000) Subject: Delete temporary output files when an error occurs during PCH reading. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac447fce02d119fb70f0aab885d836dea43e7f26;p=clang Delete temporary output files when an error occurs during PCH reading. This reduces the spam make test leaves behind in /tmp. The assert isn't particularly useful because it's not run with -disable-free (the default when using the clang driver) but should cover all -cc1 tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165910 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 24f38d428b..c50a651444 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -52,6 +52,7 @@ CompilerInstance::CompilerInstance() } CompilerInstance::~CompilerInstance() { + assert(OutputFiles.empty() && "Still output files in flight?"); } void CompilerInstance::setInvocation(CompilerInvocation *Value) { diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index ca8511247a..c8e41def8e 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -316,6 +316,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (HasBegunSourceFile) CI.getDiagnosticClient().EndSourceFile(); + CI.clearOutputFiles(/*EraseFiles=*/true); setCurrentInput(FrontendInputFile()); setCompilerInstance(0); return false;