[clang] [clang][Interp] Merge ByteCodeExprGen and ByteCodeStmtGen (PR #83683)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 05:15:11 PST 2024


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/83683 at github.com>


AaronBallman wrote:

> When implementing support for `StmtExpr`, I ran into a problem: there is no way for `ByteCodeExprGen` to visit a statement. Previously, `ByteCodeStmtGen` inherited from `ByteCodeExprGen`, so the former could visit expressions, but the latter couldn't visit statements.

I'm a bit confused.
```
class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
                        public Emitter {
```
So `ByteCodeExprGen` can definitely visit statements and expressions.

Can't `ByteCodeStmtGen` call `ByteCodeExprGen::VisitBlah()` so that the base class could also handle situations the subclass wasn't prepared to handle?

https://github.com/llvm/llvm-project/pull/83683


More information about the cfe-commits mailing list