[lldb] [Host] Refactor Socket::DecodeHostAndPort() to use LLVM API
authorMichał Górny <mgorny@moritz.systems>
Fri, 24 Sep 2021 08:28:58 +0000 (10:28 +0200)
committerMichał Górny <mgorny@moritz.systems>
Fri, 24 Sep 2021 12:58:02 +0000 (14:58 +0200)
commit5f1c8d8a432deacfeada5e5a3794d0c938171c37
tree4e823b5b1c48aab8277fff89f2d6eb6fbffcf240
parent8e4f7b749c2c03809f022c95698686c8584097fc
[lldb] [Host] Refactor Socket::DecodeHostAndPort() to use LLVM API

Refactor Socket::DecodeHostAndPort() to use LLVM API over redundant
LLDB API.  In particular, this means llvm::Regex, llvm::Error return
type and llvm::to_integer().

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.

Differential Revision: https://reviews.llvm.org/D110391
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