mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
50 lines
1.5 KiB
C++
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
|