mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Emit unenforced access markers in SILGen for accesses to local temporaries.
These accesses can't be recognized as obviously local temporaries in the verification pass, so the only way to exhaustively verify exclusivity is by added unenforced markers. SILGen currently only emits unenforced markers under -verify-exlcusivity. Once opaque values is the only supported SILGen mode, then we should turn the markers on by default (SILGen should not have different modes of operation).
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "Cleanup.h"
|
||||
#include "ExitableFullExpr.h"
|
||||
#include "Initialization.h"
|
||||
#include "LValue.h"
|
||||
#include "RValue.h"
|
||||
#include "SILGen.h"
|
||||
#include "Scope.h"
|
||||
@@ -2156,9 +2157,13 @@ void PatternMatchEmission::emitEnumElementDispatch(
|
||||
SILValue boxedValue = SGF.B.createProjectBox(loc, origCMV.getValue(), 0);
|
||||
eltTL = &SGF.getTypeLowering(boxedValue->getType());
|
||||
if (eltTL->isLoadable()) {
|
||||
UnenforcedAccess access;
|
||||
SILValue accessAddress =
|
||||
access.beginAccess(SGF, loc, boxedValue, SILAccessKind::Read);
|
||||
ManagedValue newLoadedBoxValue = SGF.B.createLoadBorrow(
|
||||
loc, ManagedValue::forUnmanaged(boxedValue));
|
||||
loc, ManagedValue::forUnmanaged(accessAddress));
|
||||
boxedValue = newLoadedBoxValue.getUnmanagedValue();
|
||||
access.endAccess(SGF);
|
||||
}
|
||||
|
||||
// The boxed value may be shared, so we always have to copy it.
|
||||
|
||||
Reference in New Issue
Block a user