[Lldb-commits] [PATCH] D110391: [lldb] [Host] Refactor Socket::DecodeHostAndPort() to use LLVM API

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 24 01:36:16 PDT 2021


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste, JDevlieghere.
mgorny requested review of this revision.

Refactor Socket::DecodeHostAndPort() to use LLVM API over redundant
LLDB API.  In particular, this means llvm::Regex and
llvm::StringRef.getAsInteger().

While at it, change the port type from int32_t to uint16_t.  The method
never returns any value outside this range, and using the correct type
allows us to rely on getAsInteger()'s implicit overflow check.


https://reviews.llvm.org/D110391

Files:
  lldb/include/lldb/Host/Socket.h
  lldb/source/Host/common/Socket.cpp
  lldb/source/Host/common/TCPSocket.cpp
  lldb/source/Host/common/UDPSocket.cpp
  lldb/tools/lldb-server/Acceptor.cpp
  lldb/unittests/Host/SocketTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110391.374754.patch
Type: text/x-patch
Size: 5560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210924/fa363fc3/attachment.bin>


More information about the lldb-commits mailing list