Skip to content

Commit ddec896

Browse files
committed
[clang][Interp][NFC] Use right visit() function
visit (lowercase V) sets DiscardValue to false and calls Visit (uppercase V). So we can't just call Visit (uppercase V) ourselves, since then we aren't handling DiscardValue correctly. This is currently irrelevant but will make a difference later. Also, the naming isn't my fault and might change later.
1 parent 55b4344 commit ddec896

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
130130
case CK_NoOp:
131131
case CK_UserDefinedConversion:
132132
case CK_NullToPointer:
133-
return this->Visit(SubExpr);
133+
return this->visit(SubExpr);
134134

135135
case CK_IntegralToBoolean:
136136
case CK_IntegralCast: {
@@ -139,7 +139,7 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
139139
if (!FromT || !ToT)
140140
return false;
141141

142-
if (!this->Visit(SubExpr))
142+
if (!this->visit(SubExpr))
143143
return false;
144144

145145
// TODO: Emit this only if FromT != ToT.
@@ -167,7 +167,7 @@ bool ByteCodeExprGen<Emitter>::VisitIntegerLiteral(const IntegerLiteral *LE) {
167167

168168
template <class Emitter>
169169
bool ByteCodeExprGen<Emitter>::VisitParenExpr(const ParenExpr *PE) {
170-
return this->Visit(PE->getSubExpr());
170+
return this->visit(PE->getSubExpr());
171171
}
172172

173173
template <class Emitter>
@@ -180,7 +180,7 @@ bool ByteCodeExprGen<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
180180
case BO_Comma:
181181
if (!discard(LHS))
182182
return false;
183-
if (!this->Visit(RHS))
183+
if (!this->visit(RHS))
184184
return false;
185185
return true;
186186
default:
@@ -264,10 +264,10 @@ bool ByteCodeExprGen<Emitter>::VisitArraySubscriptExpr(
264264
// Take pointer of LHS, add offset from RHS, narrow result.
265265
// What's left on the stack after this is a pointer.
266266
if (Optional<PrimType> IndexT = classify(Index->getType())) {
267-
if (!this->Visit(Base))
267+
if (!this->visit(Base))
268268
return false;
269269

270-
if (!this->Visit(Index))
270+
if (!this->visit(Index))
271271
return false;
272272

273273
if (!this->emitAddOffset(*IndexT, E))
@@ -590,7 +590,7 @@ bool ByteCodeExprGen<Emitter>::dereferenceVar(
590590
if (VD->hasLocalStorage() && VD->hasInit() && !VD->isConstexpr()) {
591591
QualType VT = VD->getType();
592592
if (VT.isConstQualified() && VT->isFundamentalType())
593-
return this->Visit(VD->getInit());
593+
return this->visit(VD->getInit());
594594
}
595595
}
596596

@@ -869,7 +869,7 @@ bool ByteCodeExprGen<Emitter>::visitInitializer(const Expr *Initializer) {
869869
return visitRecordInitializer(Initializer);
870870

871871
// Otherwise, visit the expression like normal.
872-
return this->Visit(Initializer);
872+
return this->visit(Initializer);
873873
}
874874

875875
template <class Emitter>
@@ -1066,21 +1066,21 @@ bool ByteCodeExprGen<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
10661066
return false;
10671067

10681068
case UO_LNot: // !x
1069-
if (!this->Visit(SubExpr))
1069+
if (!this->visit(SubExpr))
10701070
return false;
10711071
return this->emitInvBool(E);
10721072
case UO_Minus: // -x
1073-
if (!this->Visit(SubExpr))
1073+
if (!this->visit(SubExpr))
10741074
return false;
10751075
if (Optional<PrimType> T = classify(E->getType()))
10761076
return this->emitNeg(*T, E);
10771077
return false;
10781078
case UO_Plus: // +x
1079-
return this->Visit(SubExpr); // noop
1079+
return this->visit(SubExpr); // noop
10801080

10811081
case UO_AddrOf: // &x
10821082
// We should already have a pointer when we get here.
1083-
return this->Visit(SubExpr);
1083+
return this->visit(SubExpr);
10841084

10851085
case UO_Deref: // *x
10861086
return dereference(
@@ -1093,7 +1093,7 @@ bool ByteCodeExprGen<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
10931093
return DiscardResult ? this->emitPop(T, E) : true;
10941094
});
10951095
case UO_Not: // ~x
1096-
if (!this->Visit(SubExpr))
1096+
if (!this->visit(SubExpr))
10971097
return false;
10981098
if (Optional<PrimType> T = classify(E->getType()))
10991099
return this->emitComp(*T, E);

0 commit comments

Comments
 (0)