This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add `operator StringRef` to ConstString
ClosedPublic

Authored by kastiglione on Apr 12 2023, 3:06 PM.

Details

Summary

Add a StringRef conversion function to ConstString.

This will make using llvm and other non-ConstString APIs more convenient.

For demonstration, this change updates Module.cpp.

Diff Detail

Event Timeline

kastiglione created this revision.Apr 12 2023, 3:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2023, 3:06 PM
kastiglione requested review of this revision.Apr 12 2023, 3:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2023, 3:06 PM
kastiglione edited the summary of this revision. (Show Details)Apr 12 2023, 3:07 PM

I understand that the opposite direction is explicit because actual work is being done. In this direction, it shouldn't affect memory management (since ConstStrings live forever) or performance, so I think this is good (and very convenient!).
Does anyone else see a problem with this?

jasonmolenda accepted this revision.Apr 13 2023, 3:50 PM
jasonmolenda added a subscriber: jasonmolenda.

I understand that the opposite direction is explicit because actual work is being done. In this direction, it shouldn't affect memory management (since ConstStrings live forever) or performance, so I think this is good (and very convenient!).
Does anyone else see a problem with this?

I think this is safe and helpful.

This revision is now accepted and ready to land.Apr 13 2023, 3:50 PM
aprantl accepted this revision.Apr 13 2023, 4:27 PM

Okay, then let the refactor fest begin!

fdeazeve added a subscriber: fdeazeve.EditedApr 14 2023, 7:48 AM

since ConstStrings live forever

As long as this is true, I don't see any pitfalls either.

This revision was automatically updated to reflect the committed changes.