Skip to content

Commit a0653e8

Browse files
committed
[Exclusivity] Use "unsafe" access for debugger (lldb) variables.
1 parent 7163a40 commit a0653e8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
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

0 commit comments

Comments
 (0)