Files
swift-mirror/include/swift/SILOptimizer/Analysis/DestructorAnalysis.h
practicalswift 797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00

46 lines
1.5 KiB
C++

//===--- DestructorAnalysis.h -----------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SILOPTIMIZER_ANALYSIS_DESTRUCTORANALYSIS_H
#define SWIFT_SILOPTIMIZER_ANALYSIS_DESTRUCTORANALYSIS_H
#include "swift/SIL/SILValue.h"
#include "swift/SILOptimizer/Analysis/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 Ty);
bool implementsDestructorSafeContainerProtocol(NominalTypeDecl *NomDecl);
bool areTypeParametersSafe(CanType Ty);
ASTContext &getASTContext();
};
}
#endif