mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
DestructorAnalysis: Fix for recursive types
We can't just recursively process types without caching. Instead mark a type as safe before we recurse and reset this assumption if we proved otherwise on the recursive traversal. rdar://20132313 Swift SVN r26048
This commit is contained in:
@@ -14,12 +14,14 @@
|
||||
|
||||
#include "swift/SIL/SILValue.h"
|
||||
#include "swift/SILAnalysis/Analysis.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
||||
namespace swift {
|
||||
|
||||
/// This analysis determines memory effects during destruction.
|
||||
class DestructorAnalysis : public SILAnalysis {
|
||||
SILModule *Mod;
|
||||
llvm::DenseMap<CanType, bool> Cached;
|
||||
public:
|
||||
|
||||
DestructorAnalysis(SILModule *M)
|
||||
@@ -33,6 +35,7 @@ public:
|
||||
bool mayStoreToMemoryOnDestruction(SILType T);
|
||||
|
||||
protected:
|
||||
bool cacheResult(CanType Type, bool Result);
|
||||
bool isSafeType(Type);
|
||||
bool implementsDestructorSafeContainerProtocol(NominalTypeDecl *);
|
||||
bool areTypeParametersSafe(CanType);
|
||||
|
||||
Reference in New Issue
Block a user