]> granicus.if.org Git - clang/commitdiff
Delete temporary output files when an error occurs during PCH reading.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 14 Oct 2012 19:21:21 +0000 (19:21 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 14 Oct 2012 19:21:21 +0000 (19:21 +0000)
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

lib/Frontend/CompilerInstance.cpp
lib/Frontend/FrontendAction.cpp

index 24f38d428b07190b0e6df6204bb0996c219731e4..c50a651444670b095090cf2638904b8e2753f033 100644 (file)
@@ -52,6 +52,7 @@ CompilerInstance::CompilerInstance()
 }
 
 CompilerInstance::~CompilerInstance() {
+  assert(OutputFiles.empty() && "Still output files in flight?");
 }
 
 void CompilerInstance::setInvocation(CompilerInvocation *Value) {
index ca8511247a3bc39cdd79f46532f144e3bf0c6bb2..c8e41def8e3e62d0c85adbfe049b83899510af9a 100644 (file)
@@ -316,6 +316,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
 
   if (HasBegunSourceFile)
     CI.getDiagnosticClient().EndSourceFile();
+  CI.clearOutputFiles(/*EraseFiles=*/true);
   setCurrentInput(FrontendInputFile());
   setCompilerInstance(0);
   return false;