[Lldb-commits] [PATCH] D69133: eliminate nontrivial Reset(...) from TypedPythonObject

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 19 00:29:25 PDT 2019


labath added a comment.

While I appreciate the desire to reduce "boilerplate", I also think there's a lot of value in consistency. None of the existing APIs in llvm do anything like this, and are perfectly happy to call toNullTerminatedStringRef manually. You've now introduced another string-like type, which people have to figure out how it works. If you really feel like you must avoid the extra line of code (because that's the only thing that this saves, really) then you could at least move the class into the implementation of the methods, so that at least the inferface is consistent with all other llvm functions taking an llvm::Twine. You could define an llvm::Twine constructor and a "const char *" conversion operator for this class, so that you can type `Py_whatever(NullTerminated(twine))`. This way we could also define a "char *" conversion operator on the class in the PY2 case, also avoiding the need for the py2_const_cast thingy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69133





More information about the lldb-commits mailing list