[Lldb-commits] [PATCH] D82396: [lldb/ScriptInterpreter] Extract IO redirection logic and move it out of ScriptInterpreterPython (NFC)

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 26 02:08:48 PDT 2020


labath added inline comments.


================
Comment at: lldb/include/lldb/Interpreter/ScriptInterpreter.h:57-58
 private:
+  friend std::unique_ptr<ScriptInterpreterIORedirect>
+  std::make_unique<ScriptInterpreterIORedirect>();
+
----------------
labath wrote:
> If that works, I suppose it's fine. But I wouldn't be surprised if this trick backfires on some STL implementations.
> 
> I think that making an exception for make_unique on classes with private constructors is fine (we already have a bunch of classes like that)...
BTW, i've just thought of another reason to not do the friend thingy -- making std::make_unique allows _anyone_ to construct this class via std::make_unique, which defeats the purpose of making the constructor private.

OTOH, if we can successfully separate the fallible and infallible parts of the construction, then making the infallible part (constructor) public may not be that dangerous. For example, in this case, making the `(FileUP, FileUP)` constructor public might be ok.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82396





More information about the lldb-commits mailing list