StringRef was made to be passed by value efficiently.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/source/Utility/ConstString.cpp | ||
---|---|---|
305–306 | I think the const can be removed too, since StringRefs are immutable. |
lldb/source/Utility/ConstString.cpp | ||
---|---|---|
305–306 | Yeah, I can remove const and that should be fine too. But StringRef objects aren't immutable, you can modify them with methods like consume_front and consume_back. |
lldb/source/Utility/ConstString.cpp | ||
---|---|---|
305–306 | thanks for pointing that out, I was thinking about the underlying char *, which isn't mutable. Now that the StringRef is passed by copy, then the caller's copy can't be modified. |
I think the const can be removed too, since StringRefs are immutable.