Skip to content

Commit 8a8c86a

Browse files
committed
Exhaustive access marker verification.
1 parent def6d24 commit 8a8c86a

File tree

4 files changed

+383
-26
lines changed

4 files changed

+383
-26
lines changed

include/swift/SIL/InstructionUtils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ struct LLVM_LIBRARY_VISIBILITY FindClosureResult {
139139
/// by a reabstraction thunk.
140140
FindClosureResult findClosureForAppliedArg(SILValue V);
141141

142+
/// Visit each address accessed by the given memory operation.
143+
///
144+
/// This only visits instructions that modify memory in some user-visible way,
145+
/// which could be considered part of a formal access.
146+
void visitAccessedAddress(SILInstruction *I,
147+
std::function<void(Operand *)> visitor);
148+
142149
/// A utility class for evaluating whether a newly parsed or deserialized
143150
/// function has qualified or unqualified ownership.
144151
///

include/swift/SIL/SILInstruction.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,17 +3408,17 @@ class AssignInst
34083408
NonValueInstruction> {
34093409
friend SILBuilder;
34103410

3411+
FixedOperandList<2> Operands;
3412+
3413+
AssignInst(SILDebugLocation DebugLoc, SILValue Src, SILValue Dest);
3414+
3415+
public:
34113416
enum {
34123417
/// the value being stored
34133418
Src,
34143419
/// the lvalue being stored to
34153420
Dest
34163421
};
3417-
FixedOperandList<2> Operands;
3418-
3419-
AssignInst(SILDebugLocation DebugLoc, SILValue Src, SILValue Dest);
3420-
3421-
public:
34223422

34233423
SILValue getSrc() const { return Operands[Src].get(); }
34243424
SILValue getDest() const { return Operands[Dest].get(); }
@@ -3830,8 +3830,6 @@ class BindMemoryInst final :
38303830
BindMemoryInst, NonValueInstruction> {
38313831
friend SILBuilder;
38323832

3833-
enum { BaseOperIdx, IndexOperIdx, NumFixedOpers };
3834-
38353833
SILType BoundType;
38363834

38373835
static BindMemoryInst *create(
@@ -3845,6 +3843,8 @@ class BindMemoryInst final :
38453843
Loc), BoundType(BoundType) {}
38463844

38473845
public:
3846+
enum { BaseOperIdx, IndexOperIdx, NumFixedOpers };
3847+
38483848
SILValue getBase() const { return getAllOperands()[BaseOperIdx].get(); }
38493849

38503850
SILValue getIndex() const { return getAllOperands()[IndexOperIdx].get(); }
@@ -7303,12 +7303,6 @@ class CheckedCastAddrBranchInst
73037303

73047304
CastConsumptionKind ConsumptionKind;
73057305

7306-
enum {
7307-
/// the value being stored
7308-
Src,
7309-
/// the lvalue being stored to
7310-
Dest
7311-
};
73127306
FixedOperandList<2> Operands;
73137307
SILSuccessor DestBBs[2];
73147308

@@ -7327,6 +7321,13 @@ class CheckedCastAddrBranchInst
73277321
SourceType(srcType), TargetType(targetType) {}
73287322

73297323
public:
7324+
enum {
7325+
/// the value being stored
7326+
Src,
7327+
/// the lvalue being stored to
7328+
Dest
7329+
};
7330+
73307331
CastConsumptionKind getConsumptionKind() const { return ConsumptionKind; }
73317332

73327333
SILValue getSrc() const { return Operands[Src].get(); }

0 commit comments

Comments
 (0)