Files
swift-mirror/lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.h
Michael Gottesman 6c922af8aa [move-only] Combine the address/object checker in the same pass so that we only run cleanups once.
Otherwise, sometimes when the object checker emits a diagnostic and cleans up
the IR, some of the cleaned up copies are copies that should have been handled
by the address checker. The end result is that the address checker does not emit
diagnostics for that IR. I found this problem was exascerbated when writing code
for escaping closures.

This commit also cleans up the passes in preparation for at a future time moving
some of the transformations into the utils folder.
2023-02-19 13:55:22 -08:00

50 lines
1.5 KiB
C++

//===--- MoveOnlyAddressCheckerUtils.h ------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 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_MANDATORY_MOVEONLYADDRESSCHECKERUTILS_H
#define SWIFT_SILOPTIMIZER_MANDATORY_MOVEONLYADDRESSCHECKERUTILS_H
#include "MoveOnlyBorrowToDestructureUtils.h"
namespace swift {
namespace siloptimizer {
class DiagnosticEmitter;
/// Searches for candidate mark must checks.
///
/// NOTE: To see if we emitted a diagnostic, use \p
/// diagnosticEmitter.getDiagnosticCount().
void searchForCandidateAddressMarkMustChecks(
SILFunction *fn,
SmallSetVector<MarkMustCheckInst *, 32> &moveIntroducersToProcess,
DiagnosticEmitter &diagnosticEmitter);
struct MoveOnlyAddressChecker {
SILFunction *fn;
DiagnosticEmitter &diagnosticEmitter;
borrowtodestructure::IntervalMapAllocator &allocator;
DominanceInfo *domTree;
PostOrderAnalysis *poa;
/// \returns true if we changed the IR. To see if we emitted a diagnostic, use
/// \p diagnosticEmitter.getDiagnosticCount().
bool check(SmallSetVector<MarkMustCheckInst *, 32> &moveIntroducersToProcess);
};
} // namespace siloptimizer
} // namespace swift
#endif