[C++ Interop] Virtual function calls

Sounds reasonable. The this pointer adjustment is tricky.
I see the following ways that could work:

  • cxx_virtual_method just holds the decl. Special logic in the apply detects that and does virtual dispatch instead.
  • cxx_virtual_method takes a this pointer and returns an adjusted this pointer and the llvm function pointer. Apply then handles it accordingly either as a curried function or as two sil values for each the function pointer and the adjusted this.
  • cxx_virtual_method somehow does the apply all in one go.
  • Somehow we robustly disallow this pointer adjustment? Maybe just disallow importing funcs defined by multiple-inheritance? cxx_virtual_method just looks up the method in this case.