Revert "Workaround FD leaks from clang module files in performSema"

This reverts commit r25038.

Swift SVN r25041
This commit is contained in:
Ben Langmuir
2015-02-06 19:28:01 +00:00
parent 85975d3529
commit b3e9f13464

View File

@@ -26,8 +26,6 @@
#include "swift/Parse/Lexer.h" #include "swift/Parse/Lexer.h"
#include "swift/SIL/SILModule.h" #include "swift/SIL/SILModule.h"
#include "swift/Serialization/SerializedModuleLoader.h" #include "swift/Serialization/SerializedModuleLoader.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h" #include "llvm/ADT/Triple.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
@@ -223,22 +221,6 @@ Module *CompilerInstance::getMainModule() {
return MainModule; return MainModule;
} }
namespace {
class CloseClangModuleFiles {
clang::Preprocessor &PP;
public:
CloseClangModuleFiles(clang::Preprocessor &PP) : PP(PP) {}
~CloseClangModuleFiles() {
clang::ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
for (auto I = ModMap.module_begin(), E = ModMap.module_end(); I != E; ++I) {
clang::Module *M = I->second;
if (!M->isSubModule() && M->getASTFile())
M->getASTFile()->closeFile();
}
}
};
} // end anonymous namespace
void CompilerInstance::performSema() { void CompilerInstance::performSema() {
const FrontendOptions &options = Invocation.getFrontendOptions(); const FrontendOptions &options = Invocation.getFrontendOptions();
const SourceFileKind Kind = Invocation.getInputKind(); const SourceFileKind Kind = Invocation.getInputKind();
@@ -272,11 +254,6 @@ void CompilerInstance::performSema() {
auto clangImporter = auto clangImporter =
static_cast<ClangImporter *>(Context->getClangModuleLoader()); static_cast<ClangImporter *>(Context->getClangModuleLoader());
// When we exit, we won't build any more clang modules, so close the .pcm
// files to prevent fd leaks in clients that cache the AST.
// FIXME: Remove this once rdar://problem/19720334 is complete.
CloseClangModuleFiles ccmf(clangImporter->getClangPreprocessor());
Module *underlying = nullptr; Module *underlying = nullptr;
if (options.ImportUnderlyingModule) { if (options.ImportUnderlyingModule) {
underlying = clangImporter->loadModule(SourceLoc(), underlying = clangImporter->loadModule(SourceLoc(),