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.

llvm-svn: 165910

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

index 24f38d4..c50a651 100644 (file)
@@ -52,6 +52,7 @@ CompilerInstance::CompilerInstance()
 }
 
 CompilerInstance::~CompilerInstance() {
+  assert(OutputFiles.empty() && "Still output files in flight?");
 }
 
 void CompilerInstance::setInvocation(CompilerInvocation *Value) {
index ca85112..c8e41de 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;