@@ -54,7 +54,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
54
54
public:
55
55
// / Initializes the compiler and the backend emitter.
56
56
template <typename ... Tys>
57
- ByteCodeExprGen (Context &Ctx, Program &P, Tys &&... Args)
57
+ ByteCodeExprGen (Context &Ctx, Program &P, Tys &&...Args)
58
58
: Emitter(Ctx, P, Args...), Ctx(Ctx), P(P) {}
59
59
60
60
// Expression visitors - result returned on interp stack.
@@ -241,8 +241,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
241
241
llvm::function_ref<bool (PrimType)> Direct,
242
242
llvm::function_ref<bool(PrimType)> Indirect);
243
243
bool dereferenceParam (const Expr *LV, PrimType T, const ParmVarDecl *PD,
244
- DerefKind AK,
245
- llvm::function_ref<bool (PrimType)> Direct,
244
+ DerefKind AK, llvm::function_ref<bool (PrimType)> Direct,
246
245
llvm::function_ref<bool(PrimType)> Indirect);
247
246
bool dereferenceVar (const Expr *LV, PrimType T, const VarDecl *PD,
248
247
DerefKind AK, llvm::function_ref<bool (PrimType)> Direct,
@@ -400,16 +399,17 @@ template <class Emitter> class LocalScope : public VariableScope<Emitter> {
400
399
if (!Idx)
401
400
return ;
402
401
403
- for (Scope::Local &Local : this ->Ctx ->Descriptors [*Idx]) {
402
+ for (const Scope::Local &Local : this ->Ctx ->Descriptors [*Idx]) {
404
403
removeIfStoredOpaqueValue (Local);
405
404
}
406
405
}
407
406
408
407
void removeIfStoredOpaqueValue (const Scope::Local &Local) {
409
408
if (auto *OVE =
410
- llvm::dyn_cast_or_null<OpaqueValueExpr>(Local.Desc ->asExpr ());
411
- OVE && this ->Ctx ->OpaqueExprs .contains (OVE)) {
412
- this ->Ctx ->OpaqueExprs .erase (OVE);
409
+ llvm::dyn_cast_if_present<OpaqueValueExpr>(Local.Desc ->asExpr ())) {
410
+ if (auto it = this ->Ctx ->OpaqueExprs .find (OVE);
411
+ it != this ->Ctx ->OpaqueExprs .end ())
412
+ this ->Ctx ->OpaqueExprs .erase (it);
413
413
};
414
414
}
415
415
0 commit comments