[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 11:24:58 +0000 (13:24 +0200)
commita6daf99228bc16fb7f2596d67a0d00fef327ace5
treed308e52fd89766aab14f8d876451db5f7c2c4a68
parente4e95f14f15aceb2641c2b917eca58aaf988c4a7
[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