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

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 7 21:04:06 PDT 2023


jasonmolenda added a comment.

In D147833#4252681 <https://reviews.llvm.org/D147833#4252681>, @bulbazord wrote:

> 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.

OK, I see.  I saw the `==` and thought something must be constructed to an object for that operator to work, I didn't even think of address comparing constant data c-strings.


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