mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user