Fix leak of LookupCache

The lookup cache isn't allocated in the ASTContext, so seting up a
destructor cleanup isn't sufficient to get the memory released.  Luckily
SourceFile and BuiltinUnit already have their own destructor called, so
we can use std::unique_ptr.

rdar://problem/22387897

Swift SVN r31561
This commit is contained in:
Ben Langmuir
2015-08-28 21:38:05 +00:00
parent 8d656dec8b
commit 54f6bb41ff
2 changed files with 8 additions and 9 deletions

View File

@@ -850,7 +850,7 @@ public:
using ImportOptions = OptionSet<ImportFlags>;
private:
LookupCache *Cache = nullptr;
std::unique_ptr<LookupCache> Cache;
LookupCache &getCache() const;
/// This is the list of modules that are imported by this module.
@@ -1107,7 +1107,7 @@ public:
class LookupCache;
private:
LookupCache *Cache = nullptr;
std::unique_ptr<LookupCache> Cache;
LookupCache &getCache() const;
friend ASTContext;