[clang] ddec896 - [clang][Interp][NFC] Use right visit() function
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 28 08:45:29 PDT 2022
Author: Timm Bäder
Date: 2022-10-28T17:44:53+02:00
New Revision: ddec89670dd873a293c958a8fc7f778e3cc4297b
URL: https://github.com/llvm/llvm-project/commit/ddec89670dd873a293c958a8fc7f778e3cc4297b
DIFF: https://github.com/llvm/llvm-project/commit/ddec89670dd873a293c958a8fc7f778e3cc4297b.diff
LOG: [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.
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 20e5d2911a1f..02d7ff2d2304 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -130,7 +130,7 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
case CK_NoOp:
case CK_UserDefinedConversion:
case CK_NullToPointer:
- return this->Visit(SubExpr);
+ return this->visit(SubExpr);
case CK_IntegralToBoolean:
case CK_IntegralCast: {
@@ -139,7 +139,7 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
if (!FromT || !ToT)
return false;
- if (!this->Visit(SubExpr))
+ if (!this->visit(SubExpr))
return false;
// TODO: Emit this only if FromT != ToT.
@@ -167,7 +167,7 @@ bool ByteCodeExprGen<Emitter>::VisitIntegerLiteral(const IntegerLiteral *LE) {
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitParenExpr(const ParenExpr *PE) {
- return this->Visit(PE->getSubExpr());
+ return this->visit(PE->getSubExpr());
}
template <class Emitter>
@@ -180,7 +180,7 @@ bool ByteCodeExprGen<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
case BO_Comma:
if (!discard(LHS))
return false;
- if (!this->Visit(RHS))
+ if (!this->visit(RHS))
return false;
return true;
default:
@@ -264,10 +264,10 @@ bool ByteCodeExprGen<Emitter>::VisitArraySubscriptExpr(
// Take pointer of LHS, add offset from RHS, narrow result.
// What's left on the stack after this is a pointer.
if (Optional<PrimType> IndexT = classify(Index->getType())) {
- if (!this->Visit(Base))
+ if (!this->visit(Base))
return false;
- if (!this->Visit(Index))
+ if (!this->visit(Index))
return false;
if (!this->emitAddOffset(*IndexT, E))
@@ -590,7 +590,7 @@ bool ByteCodeExprGen<Emitter>::dereferenceVar(
if (VD->hasLocalStorage() && VD->hasInit() && !VD->isConstexpr()) {
QualType VT = VD->getType();
if (VT.isConstQualified() && VT->isFundamentalType())
- return this->Visit(VD->getInit());
+ return this->visit(VD->getInit());
}
}
@@ -869,7 +869,7 @@ bool ByteCodeExprGen<Emitter>::visitInitializer(const Expr *Initializer) {
return visitRecordInitializer(Initializer);
// Otherwise, visit the expression like normal.
- return this->Visit(Initializer);
+ return this->visit(Initializer);
}
template <class Emitter>
@@ -1066,21 +1066,21 @@ bool ByteCodeExprGen<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
return false;
case UO_LNot: // !x
- if (!this->Visit(SubExpr))
+ if (!this->visit(SubExpr))
return false;
return this->emitInvBool(E);
case UO_Minus: // -x
- if (!this->Visit(SubExpr))
+ if (!this->visit(SubExpr))
return false;
if (Optional<PrimType> T = classify(E->getType()))
return this->emitNeg(*T, E);
return false;
case UO_Plus: // +x
- return this->Visit(SubExpr); // noop
+ return this->visit(SubExpr); // noop
case UO_AddrOf: // &x
// We should already have a pointer when we get here.
- return this->Visit(SubExpr);
+ return this->visit(SubExpr);
case UO_Deref: // *x
return dereference(
@@ -1093,7 +1093,7 @@ bool ByteCodeExprGen<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
return DiscardResult ? this->emitPop(T, E) : true;
});
case UO_Not: // ~x
- if (!this->Visit(SubExpr))
+ if (!this->visit(SubExpr))
return false;
if (Optional<PrimType> T = classify(E->getType()))
return this->emitComp(*T, E);
More information about the cfe-commits
mailing list