mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Move entirety of llvm namespace to wpi namespace.
During shared library loading, a different libLLVM can be pulled in, causing llvm symbols from dependent libraries to resolve to that library instead of this one. This has been seen in the wild with the Mesa OpenGL implementation in JavaFX applications (see wpilibsuite/shuffleboard#361). This is clearly a very breaking change. For some level of backwards compatibility, a namespace alias from llvm to wpi is performed in the "llvm" headers. Unfortunately, forward declarations of llvm classes will still break, but compilers seem to generate clear error messages in those cases ("namespace alias 'llvm' not allowed here, assuming 'wpi'"). This change also moves all the wpiutil headers to a single "wpi" subdirectory from the previously split "llvm", "support", "tcpsockets", and "udpsockets". Shim headers will be added for backwards compatibility in a later commit.
This commit is contained in:
@@ -73,14 +73,14 @@ SerialPort::SerialPort(int baudRate, Port port, int dataBits,
|
||||
* @param stopBits The number of stop bits to use as defined by the enum
|
||||
* StopBits.
|
||||
*/
|
||||
SerialPort::SerialPort(int baudRate, llvm::StringRef portName, Port port,
|
||||
SerialPort::SerialPort(int baudRate, wpi::StringRef portName, Port port,
|
||||
int dataBits, SerialPort::Parity parity,
|
||||
SerialPort::StopBits stopBits) {
|
||||
int32_t status = 0;
|
||||
|
||||
m_port = port;
|
||||
|
||||
llvm::SmallVector<char, 64> buf;
|
||||
wpi::SmallVector<char, 64> buf;
|
||||
const char* portNameC = portName.c_str(buf);
|
||||
|
||||
HAL_InitializeSerialPortDirect(static_cast<HAL_SerialPort>(port), portNameC,
|
||||
@@ -194,7 +194,7 @@ int SerialPort::Read(char* buffer, int count) {
|
||||
* @return The number of bytes actually written into the port.
|
||||
*/
|
||||
int SerialPort::Write(const char* buffer, int count) {
|
||||
return Write(llvm::StringRef(buffer, static_cast<size_t>(count)));
|
||||
return Write(wpi::StringRef(buffer, static_cast<size_t>(count)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +206,7 @@ int SerialPort::Write(const char* buffer, int count) {
|
||||
* @param buffer StringRef to the buffer to read the bytes from.
|
||||
* @return The number of bytes actually written into the port.
|
||||
*/
|
||||
int SerialPort::Write(llvm::StringRef buffer) {
|
||||
int SerialPort::Write(wpi::StringRef buffer) {
|
||||
int32_t status = 0;
|
||||
int retVal = HAL_WriteSerial(static_cast<HAL_SerialPort>(m_port),
|
||||
buffer.data(), buffer.size(), &status);
|
||||
|
||||
Reference in New Issue
Block a user