File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -3138,16 +3138,17 @@ bool ByteCodeExprGen<Emitter>::VisitComplexUnaryOperator(
3138
3138
return this ->discard (SubExpr);
3139
3139
3140
3140
std::optional<PrimType> ResT = classify (E);
3141
+ auto prepareResult = [=]() -> bool {
3142
+ if (!ResT && !Initializing) {
3143
+ std::optional<unsigned > LocalIndex =
3144
+ allocateLocal (SubExpr, /* IsExtended=*/ false );
3145
+ if (!LocalIndex)
3146
+ return false ;
3147
+ return this ->emitGetPtrLocal (*LocalIndex, E);
3148
+ }
3141
3149
3142
- // Prepare storage for result.
3143
- if (!ResT && !Initializing) {
3144
- std::optional<unsigned > LocalIndex =
3145
- allocateLocal (SubExpr, /* IsExtended=*/ false );
3146
- if (!LocalIndex)
3147
- return false ;
3148
- if (!this ->emitGetPtrLocal (*LocalIndex, E))
3149
- return false ;
3150
- }
3150
+ return true ;
3151
+ };
3151
3152
3152
3153
// The offset of the temporary, if we created one.
3153
3154
unsigned SubExprOffset = ~0u ;
@@ -3167,6 +3168,8 @@ bool ByteCodeExprGen<Emitter>::VisitComplexUnaryOperator(
3167
3168
3168
3169
switch (E->getOpcode ()) {
3169
3170
case UO_Minus:
3171
+ if (!prepareResult ())
3172
+ return false ;
3170
3173
if (!createTemp ())
3171
3174
return false ;
3172
3175
for (unsigned I = 0 ; I != 2 ; ++I) {
@@ -3179,7 +3182,9 @@ bool ByteCodeExprGen<Emitter>::VisitComplexUnaryOperator(
3179
3182
}
3180
3183
break ;
3181
3184
3182
- case UO_AddrOf:
3185
+ case UO_Plus: // +x
3186
+ case UO_AddrOf: // &x
3187
+ case UO_Deref: // *x
3183
3188
return this ->delegate (SubExpr);
3184
3189
3185
3190
case UO_LNot:
You can’t perform that action at this time.
0 commit comments