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



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to