[clang] [clang-repl] Expose RuntimeInterfaceBuilder to allow customization (PR #83126)

Stefan Gränitz via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 02:39:36 PST 2024


weliveindetail wrote:

Alright. The above change makes it as cheap as it gets with an abstraction: virtual function calls only on init and one function pointer call for each processed statement.

> I was wondering if we can extend that functionality via a callback mechanism 

How would that look like? I assume the runtime interface will have other functions than `getCall()` in the future right? Then we need to keep it as an entity. What is the difference between a callback and the virtual function call from the first patch?

We can change it to provide function pointers instead like in my last patch. It's less idiomatic but a bit cheaper. Of course we could use `std::function` callbacks and capturing lambdas instead, but I am afraid that would be even more expensive than the virtual function proposal.

> We also have some pending work (which I was planning on working when time permits) in that area [D146809](https://reviews.llvm.org/D146809). I was wondering if that'd interfere with your work...

Your patch doesn't actually touch the `RuntimeInterfaceBuilder`, so this should be no problem.


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


More information about the cfe-commits mailing list