[Lldb-commits] [PATCH] D68188: allow arbitrary python streams to be converted to SBFile

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 2 04:28:30 PDT 2019


labath added a comment.

Hmm... I like your solution of the typemap problem, but this CRTP class seems to be way more complicated than needed. There shouldn't be any need for CRTP as we already have regular dynamic dispatch via virtual methods. Also, I don't think the forwarding should be needed if you're going the template route. How about something like this instead?

  template<typename Base>
  class OwningPythonFile : public Base {
    Status Close() { /* close magic here*/; }
    // no need to forward anything -- inheritance handles that
  };
  
  class TextPythonFile: public OwningPythonFile<File> {
    // override methods as usual
  };
  // same for BinaryPythonFile

Then depending on what you need, you create either a NativeFile, OwningPythonFile<NativeFile>, or a Text/BinaryPythonFile. How does that sound?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68188/new/

https://reviews.llvm.org/D68188





More information about the lldb-commits mailing list