Merge pull request #26816 from jrose-apple/cant-stand-the-rain

Fix a pair of leaks related to FileUnit destructors not being run
This commit is contained in:
Jordan Rose
2019-08-26 11:06:54 -07:00
committed by GitHub
12 changed files with 46 additions and 62 deletions

View File

@@ -55,6 +55,11 @@
using namespace swift;
static_assert(IsTriviallyDestructible<FileUnit>::value,
"FileUnits are BumpPtrAllocated; the d'tor may not be called");
static_assert(IsTriviallyDestructible<LoadedFile>::value,
"LoadedFiles are BumpPtrAllocated; the d'tor may not be called");
//===----------------------------------------------------------------------===//
// Builtin Module Name lookup
//===----------------------------------------------------------------------===//
@@ -1249,10 +1254,6 @@ StringRef ModuleDecl::getModuleFilename() const {
// per-file names. Modules can consist of more than one file.
StringRef Result;
for (auto F : getFiles()) {
Result = F->getParseableInterface();
if (!Result.empty())
return Result;
if (auto SF = dyn_cast<SourceFile>(F)) {
if (!Result.empty())
return StringRef();