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:
Peter Johnson
2018-04-29 23:33:19 -07:00
parent 93859eb84f
commit f84018af5f
377 changed files with 2747 additions and 2742 deletions

View File

@@ -10,7 +10,7 @@
#include <HAL/HAL.h>
#include <HAL/Ports.h>
#include <HAL/Relay.h>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "MotorSafetyHelper.h"
#include "SensorBase.h"
@@ -32,7 +32,7 @@ Relay::Relay(int channel, Relay::Direction direction)
: m_channel(channel), m_direction(direction) {
if (!SensorBase::CheckRelayChannel(m_channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Relay Channel " + llvm::Twine(m_channel));
"Relay Channel " + wpi::Twine(m_channel));
return;
}
@@ -268,7 +268,7 @@ bool Relay::IsSafetyEnabled() const {
return m_safetyHelper->IsSafetyEnabled();
}
void Relay::GetDescription(llvm::raw_ostream& desc) const {
void Relay::GetDescription(wpi::raw_ostream& desc) const {
desc << "Relay " << GetChannel();
}
@@ -277,7 +277,7 @@ void Relay::InitSendable(SendableBuilder& builder) {
builder.SetSafeState([=]() { Set(kOff); });
builder.AddSmallStringProperty(
"Value",
[=](llvm::SmallVectorImpl<char>& buf) -> llvm::StringRef {
[=](wpi::SmallVectorImpl<char>& buf) -> wpi::StringRef {
switch (Get()) {
case kOn:
return "On";
@@ -289,7 +289,7 @@ void Relay::InitSendable(SendableBuilder& builder) {
return "Off";
}
},
[=](llvm::StringRef value) {
[=](wpi::StringRef value) {
if (value == "Off")
Set(kOff);
else if (value == "Forward")