Skip to content

Commit b4c6ab6

Browse files
committed
[clang][Interp][NFC] Don't use visitLocalInitializer in visitExpr
We were unnecessarily getting the pointer of the local variable twice.
1 parent 4fb7b33 commit b4c6ab6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,10 +2555,13 @@ bool ByteCodeExprGen<Emitter>::visitExpr(const Expr *E) {
25552555
// For us, that means everything we don't
25562556
// have a PrimType for.
25572557
if (std::optional<unsigned> LocalOffset = this->allocateLocal(E)) {
2558-
if (!this->visitLocalInitializer(E, *LocalOffset))
2558+
if (!this->emitGetPtrLocal(*LocalOffset, E))
25592559
return false;
25602560

2561-
if (!this->emitGetPtrLocal(*LocalOffset, E))
2561+
if (!visitInitializer(E))
2562+
return false;
2563+
2564+
if (!this->emitInitPtr(E))
25622565
return false;
25632566
return this->emitRetValue(E);
25642567
}

0 commit comments

Comments
 (0)