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

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 07:19:54 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>


tbaederr wrote:

> So ByteCodeExprGen can definitely visit statements and expressions.

Well yes, the possibility is there, but it doesn't implement any of the functionality when visiting statements. :)


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

That's what's happening in `ByteCodeStmtGen::visitStmt()` in case the statement is an `Expr` - `ByteCodeStmtGen` just calls `ByteCodeExprGen::discard()`.

But that's not the problem I have in mind. My problem is the other way around: when `ByteCodeExprGen` needs to generate code for statements. It has no `visitStmt` function, because that's only implemented in the subclass.


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


More information about the cfe-commits mailing list