Skip to content

Commit 46ddcaa

Browse files
authored
Merge pull request #9016 from atrick/fix
2 parents e44bcca + 39cd812 commit 46ddcaa

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,18 @@ static LValueTypeData getPhysicalStorageTypeData(SILGenModule &SGM,
130130
}
131131

132132
static bool shouldUseUnsafeEnforcement(VarDecl *var) {
133-
return false; // TODO
133+
if (var->isDebuggerVar())
134+
return true;
135+
136+
// TODO: Check for the explicit "unsafe" attribute.
137+
return false;
134138
}
135139

136140
Optional<SILAccessEnforcement>
137141
SILGenFunction::getStaticEnforcement(VarDecl *var) {
142+
if (var && shouldUseUnsafeEnforcement(var))
143+
return SILAccessEnforcement::Unsafe;
144+
138145
return SILAccessEnforcement::Static;
139146
}
140147

@@ -150,6 +157,9 @@ SILGenFunction::getDynamicEnforcement(VarDecl *var) {
150157

151158
Optional<SILAccessEnforcement>
152159
SILGenFunction::getUnknownEnforcement(VarDecl *var) {
160+
if (var && shouldUseUnsafeEnforcement(var))
161+
return SILAccessEnforcement::Unsafe;
162+
153163
return SILAccessEnforcement::Unknown;
154164
}
155165

lib/SILOptimizer/Mandatory/AccessEnforcementSelection.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,7 @@ struct AccessEnforcementSelection : SILFunctionTransform {
382382
// dependent BeginAccess).
383383
//
384384
// Running before diagnostic constant propagation requires handling 'undef'.
385-
//
386-
// FIXME: This assert will eventually be important, but for now it's safe to
387-
// disable until this problem is resolved:
388-
// <rdar://problem/31797132> [Exclusivity] lldb asserts in
389-
// AccessEnforcementSelector
390-
// assert(isa<AllocStackInst>(address) || isa<SILUndef>(address));
385+
assert(isa<AllocStackInst>(address) || isa<SILUndef>(address));
391386
setStaticEnforcement(access);
392387
}
393388

0 commit comments

Comments
 (0)