mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "Workaround FD leaks from clang module files in performSema"
This reverts commit r25038. Swift SVN r25041
This commit is contained in:
@@ -26,8 +26,6 @@
|
||||
#include "swift/Parse/Lexer.h"
|
||||
#include "swift/SIL/SILModule.h"
|
||||
#include "swift/Serialization/SerializedModuleLoader.h"
|
||||
#include "clang/Lex/HeaderSearch.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@@ -223,22 +221,6 @@ Module *CompilerInstance::getMainModule() {
|
||||
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() {
|
||||
const FrontendOptions &options = Invocation.getFrontendOptions();
|
||||
const SourceFileKind Kind = Invocation.getInputKind();
|
||||
@@ -272,11 +254,6 @@ void CompilerInstance::performSema() {
|
||||
auto clangImporter =
|
||||
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;
|
||||
if (options.ImportUnderlyingModule) {
|
||||
underlying = clangImporter->loadModule(SourceLoc(),
|
||||
|
||||
Reference in New Issue
Block a user