@@ -184,7 +184,7 @@ template <PrimType OpType> bool EvalEmitter::emitRet(const SourceInfo &Info) {
184
184
return true ;
185
185
186
186
using T = typename PrimConv<OpType>::T;
187
- EvalResult.setValue (S.Stk .pop <T>().toAPValue (Ctx.getASTContext ()));
187
+ EvalResult.takeValue (S.Stk .pop <T>().toAPValue (Ctx.getASTContext ()));
188
188
return true ;
189
189
}
190
190
@@ -195,7 +195,7 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
195
195
const Pointer &Ptr = S.Stk .pop <Pointer>();
196
196
197
197
if (Ptr.isFunctionPointer ()) {
198
- EvalResult.setValue (Ptr.toAPValue (Ctx.getASTContext ()));
198
+ EvalResult.takeValue (Ptr.toAPValue (Ctx.getASTContext ()));
199
199
return true ;
200
200
}
201
201
@@ -224,7 +224,7 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
224
224
225
225
if (std::optional<APValue> V =
226
226
Ptr.toRValue (Ctx, EvalResult.getSourceType ())) {
227
- EvalResult.setValue (*V );
227
+ EvalResult.takeValue ( std::move (*V) );
228
228
} else {
229
229
return false ;
230
230
}
@@ -233,14 +233,14 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
233
233
// the result, even if the pointer is dead.
234
234
// This will later be diagnosed by CheckLValueConstantExpression.
235
235
if (Ptr.isBlockPointer () && !Ptr.block ()->isStatic ()) {
236
- EvalResult.setValue (Ptr.toAPValue (Ctx.getASTContext ()));
236
+ EvalResult.takeValue (Ptr.toAPValue (Ctx.getASTContext ()));
237
237
return true ;
238
238
}
239
239
240
240
if (!Ptr.isLive () && !Ptr.isTemporary ())
241
241
return false ;
242
242
243
- EvalResult.setValue (Ptr.toAPValue (Ctx.getASTContext ()));
243
+ EvalResult.takeValue (Ptr.toAPValue (Ctx.getASTContext ()));
244
244
}
245
245
246
246
return true ;
@@ -261,7 +261,7 @@ bool EvalEmitter::emitRetValue(const SourceInfo &Info) {
261
261
262
262
if (std::optional<APValue> APV =
263
263
Ptr.toRValue (S.getASTContext (), EvalResult.getSourceType ())) {
264
- EvalResult.setValue ( *APV);
264
+ EvalResult.takeValue ( std::move ( *APV) );
265
265
return true ;
266
266
}
267
267
0 commit comments