mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a separate 'verifyOwnership()' entry point so it's possible to check OSSA lifetimes at various points. Move SILGenCleanup into a SILGen pass pipeline. After SILGen, verify incomplete OSSA. After SILGenCleanup, verify ownership.
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
//===--- VerifierPrivate.h ------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2020 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_SIL_VERIFIER_VERIFIERPRIVATE_H
|
|
#define SWIFT_SIL_VERIFIER_VERIFIERPRIVATE_H
|
|
|
|
#include "swift/Basic/MultiMapCache.h"
|
|
#include "swift/SIL/MemAccessUtils.h"
|
|
#include "swift/SIL/SILValue.h"
|
|
|
|
namespace swift {
|
|
|
|
class BeginAccessInst;
|
|
class LoadBorrowInst;
|
|
class SILValue;
|
|
class Operand;
|
|
|
|
namespace silverifier {
|
|
|
|
class LoadBorrowImmutabilityAnalysis {
|
|
SmallMultiMapCache<AccessPath, Operand *> cache;
|
|
DeadEndBlocks *deadEndBlocks = nullptr;
|
|
|
|
public:
|
|
/// \p deadEndBlocks should be nullptr to enforce complete OSSA lifetimes.
|
|
LoadBorrowImmutabilityAnalysis(DeadEndBlocks *deadEndBlocks,
|
|
const SILFunction *f);
|
|
|
|
/// Returns true if exhaustively lbi is guaranteed to never be invalidated by
|
|
/// local writes.
|
|
bool isImmutable(LoadBorrowInst *lbi);
|
|
|
|
private:
|
|
bool isImmutableInScope(LoadBorrowInst *lbi,
|
|
AccessPathWithBase accessPathWithBase);
|
|
};
|
|
|
|
} // namespace silverifier
|
|
} // namespace swift
|
|
|
|
#endif
|