Remove FailedImportModule. A failed import is now represented as an empty TU.

No other functionality change.

Swift SVN r10833
This commit is contained in:
Jordan Rose
2013-12-05 01:51:10 +00:00
parent 8b8cc8ee62
commit 68272b15c4
3 changed files with 21 additions and 60 deletions

View File

@@ -634,6 +634,8 @@ class TranslationUnit : public Module {
/// lookups.
ExternalNameLookup *ExternalLookup = nullptr;
// FIXME: This storage is never freed, because Modules are allocated on the
// ASTContext.
TinyPtrVector<FileUnit *> Files;
public:
@@ -657,6 +659,18 @@ public:
Files.push_back(&newFile);
}
void removeFile(FileUnit &existingFile) {
// Do a reverse search; usually the file to be deleted will be at the end.
std::reverse_iterator<decltype(Files)::iterator> I(Files.end()),
E(Files.begin());
I = std::find(I, E, &existingFile);
assert(I != E);
// Adjust for the std::reverse_iterator offset.
++I;
Files.erase(I.base());
}
/// Convenience accessor for clients that know what kind of file they're
/// dealing with.
SourceFile &getMainSourceFile(SourceFile::SourceKind expectedKind) const {