Files
swift-mirror/include/swift/SILAnalysis/DestructorAnalysis.h
Arnold Schwaighofer a68f488e99 Revert "DestructorAnalysis: Don't rely on stable cannonical type pointers"
This reverts commit r26049.

Canonical types really should to be stable across the lifetime of one module.

Swift SVN r26080
2015-03-13 02:01:35 +00:00

46 lines
1.4 KiB
C++

//===--- DestructorAnalysis.h ------------------------------*- C++ -*------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SILANALYSIS_DESTRUCTORANALYSIS_H
#define SWIFT_SILANALYSIS_DESTRUCTORANALYSIS_H
#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)
: SILAnalysis(AnalysisKind::Destructor), Mod(M) {}
static bool classof(const SILAnalysis *S) {
return S->getKind() == AnalysisKind::Destructor;
}
/// Returns true if destruction of T may store to memory.
bool mayStoreToMemoryOnDestruction(SILType T);
protected:
bool cacheResult(CanType Type, bool Result);
bool isSafeType(Type);
bool implementsDestructorSafeContainerProtocol(NominalTypeDecl *);
bool areTypeParametersSafe(CanType);
ASTContext &getASTContext();
};
}
#endif