Skip to content

Commit e5fb656

Browse files
committed
[clang][Interp] Handle RecoveryExprs
Instead of checking containsErrors() for every expression, just handle RecoveryExprs directly.
1 parent b6d24cb commit e5fb656

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,30 +2487,26 @@ bool ByteCodeExprGen<Emitter>::VisitPackIndexingExpr(
24872487
return this->delegate(E->getSelectedExpr());
24882488
}
24892489

2490-
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
2491-
if (E->containsErrors())
2492-
return false;
2490+
template <class Emitter>
2491+
bool ByteCodeExprGen<Emitter>::VisitRecoveryExpr(const RecoveryExpr *E) {
2492+
return this->emitError(E);
2493+
}
24932494

2495+
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
24942496
OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/true,
24952497
/*NewInitializing=*/false);
24962498
return this->Visit(E);
24972499
}
24982500

24992501
template <class Emitter>
25002502
bool ByteCodeExprGen<Emitter>::delegate(const Expr *E) {
2501-
if (E->containsErrors())
2502-
return this->emitError(E);
2503-
25042503
// We're basically doing:
25052504
// OptionScope<Emitter> Scope(this, DicardResult, Initializing);
25062505
// but that's unnecessary of course.
25072506
return this->Visit(E);
25082507
}
25092508

25102509
template <class Emitter> bool ByteCodeExprGen<Emitter>::visit(const Expr *E) {
2511-
if (E->containsErrors())
2512-
return this->emitError(E);
2513-
25142510
if (E->getType()->isVoidType())
25152511
return this->discard(E);
25162512

clang/lib/AST/Interp/ByteCodeExprGen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
121121
bool VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *E);
122122
bool VisitPseudoObjectExpr(const PseudoObjectExpr *E);
123123
bool VisitPackIndexingExpr(const PackIndexingExpr *E);
124+
bool VisitRecoveryExpr(const RecoveryExpr *E);
124125

125126
protected:
126127
bool visitExpr(const Expr *E) override;

0 commit comments

Comments
 (0)