[Lldb-commits] [PATCH] D85243: Factor out common code from the iPhone/AppleTV/WatchOS simulator platform plugins. (NFC)

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 6 13:50:21 PDT 2020


aprantl added inline comments.


================
Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h:96
 protected:
+  const char *m_class_name;
+  const char *m_description;
----------------
JDevlieghere wrote:
> aprantl wrote:
> > JDevlieghere wrote:
> > > "While you are here" could we make these StringRefs? 
> > I could, but these are used specifically/only for the lldb Plugin API:
> > 
> > `const char *GetDescription() override { return m_description; }`
> > 
> > Do you think it's worth doing regardless?
> > 
> I think it'd be nice, but more something for a separate NFC patch. It's definitely not that important and I'm sure you have better stuff to do :p 
I just tried to do this, which made me realize that a StringRef is objectively worse. A StringRef doesn't guarantee a NUL-terminated string, so we'd either need to make this a documented requirement (kind of dangerous) or write return m_description.str().c_str(), which is also silly.

The right thing to do is to change the Plugin interface itself to use StringRef.


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

https://reviews.llvm.org/D85243



More information about the lldb-commits mailing list