[Lldb-commits] [PATCH] D147833: [lldb] Change return type of EventData::GetFlavor

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 7 20:48:59 PDT 2023


bulbazord added a comment.

In D147833#4252651 <https://reviews.llvm.org/D147833#4252651>, @jasonmolenda wrote:

> Am I missing something, how does this work when we have uses like `event_data->GetFlavor() == TargetEventData::GetFlavorString()` - is this changing from a one-time construction of a ConstString to a construction of a ConstString every time it's called by implicit construction?

`event_data->GetFlavor() == TargetEventData::GetFlavorString()` would be just a straight pointer comparison, no ConstString in the picture. These strings don't need to be in the ConstString pool -- they only exist in one place each and are guaranteed to be there for the lifetime of a running lldb process. There are other places in lldb where I'd like to do this, but I figured I'd do it in a few smaller patches rather than one giant patch.



================
Comment at: lldb/source/Utility/Event.cpp:183
+const char *EventDataReceipt::GetFlavorString() {
+  return "Process::ProcessEventData";
+}
----------------
Note: this is probably the wrong flavor string (i.e. a bug) but I'm just preserving existing behavior here, for better or worse.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147833



More information about the lldb-commits mailing list