[Lldb-commits] [PATCH] D24013: Removed the `GetStringRef()` functions of `StringExtractor`
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 29 16:17:18 PDT 2016
zturner created this revision.
zturner added reviewers: labath, tberghammer.
zturner added a subscriber: lldb-commits.
The motivation here was that operations which were using the `const` version of this function might as well be using `Peek()`, since it does essentially the same thing. And since `Peek()` was updated to return `StringRef`, it even provides a more useful interface than `std::string`.
On the other hand, operations which were using the non `const` version of the function won't work in an environment where `StringExtractor` stores a `StringRef` instead of a `std::string`, and on top of that they are unsafe since modifying the `StringExtractor` by exposing its internals breaks encapsulation and requires the user to remember to update the file pos lest the class enter an invalid state.
So I add a new `SetString()` method. Instead of calling `GetStringRef()` and then manipulating the result, you just manipulate a `std::string` you create yourself, and then call `SetString()`.
Because calls to the `const` version of `GetStringRef()` are changed to using `Peek()`, certain functions that were reproducing functionality already built in to `StringRef` have been simplified quite a bit.
https://reviews.llvm.org/D24013
Files:
include/lldb/Core/Event.h
include/lldb/Core/RegularExpression.h
include/lldb/Utility/StringExtractor.h
source/Core/Event.cpp
source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
source/Utility/StringExtractor.cpp
source/Utility/StringExtractorGDBRemote.cpp
unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
unittests/Utility/StringExtractorTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24013.69631.patch
Type: text/x-patch
Size: 51852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160829/5c4d1b87/attachment-0001.bin>
More information about the lldb-commits
mailing list