mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Remove FailedImportModule. A failed import is now represented as an empty TU.
No other functionality change. Swift SVN r10833
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user