mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +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:
@@ -33,7 +33,7 @@ Command::Command() : Command("", -1.0) {}
|
||||
*
|
||||
* @param name the name for this command
|
||||
*/
|
||||
Command::Command(const llvm::Twine& name) : Command(name, -1.0) {}
|
||||
Command::Command(const wpi::Twine& name) : Command(name, -1.0) {}
|
||||
|
||||
/**
|
||||
* Creates a new command with the given timeout and a default name.
|
||||
@@ -50,7 +50,7 @@ Command::Command(double timeout) : Command("", timeout) {}
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
* @see IsTimedOut()
|
||||
*/
|
||||
Command::Command(const llvm::Twine& name, double timeout)
|
||||
Command::Command(const wpi::Twine& name, double timeout)
|
||||
: SendableBase(false) {
|
||||
// We use -1.0 to indicate no timeout.
|
||||
if (timeout < 0.0 && timeout != -1.0)
|
||||
@@ -61,7 +61,7 @@ Command::Command(const llvm::Twine& name, double timeout)
|
||||
// If name contains an empty string
|
||||
if (name.isTriviallyEmpty() ||
|
||||
(name.isSingleStringRef() && name.getSingleStringRef().empty())) {
|
||||
SetName("Command_" + llvm::Twine(typeid(*this).name()));
|
||||
SetName("Command_" + wpi::Twine(typeid(*this).name()));
|
||||
} else {
|
||||
SetName(name);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ using namespace frc;
|
||||
*
|
||||
* @param name The name for this command group
|
||||
*/
|
||||
CommandGroup::CommandGroup(const llvm::Twine& name) : Command(name) {}
|
||||
CommandGroup::CommandGroup(const wpi::Twine& name) : Command(name) {}
|
||||
|
||||
/**
|
||||
* Adds a new Command to the group. The Command will be started after all the
|
||||
|
||||
@@ -44,7 +44,7 @@ ConditionalCommand::ConditionalCommand(Command* onTrue, Command* onFalse) {
|
||||
* @param onTrue The Command to execute if Condition() returns true
|
||||
* @param onFalse The Command to execute if Condition() returns false
|
||||
*/
|
||||
ConditionalCommand::ConditionalCommand(const llvm::Twine& name, Command* onTrue,
|
||||
ConditionalCommand::ConditionalCommand(const wpi::Twine& name, Command* onTrue,
|
||||
Command* onFalse)
|
||||
: Command(name) {
|
||||
m_onTrue = onTrue;
|
||||
|
||||
@@ -14,6 +14,6 @@ using namespace frc;
|
||||
*
|
||||
* @param name The name for this command
|
||||
*/
|
||||
InstantCommand::InstantCommand(const llvm::Twine& name) : Command(name) {}
|
||||
InstantCommand::InstantCommand(const wpi::Twine& name) : Command(name) {}
|
||||
|
||||
bool InstantCommand::IsFinished() { return true; }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d,
|
||||
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
double f, double period)
|
||||
: Command(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
@@ -22,12 +22,12 @@ PIDCommand::PIDCommand(double p, double i, double d, double f, double period) {
|
||||
std::make_shared<PIDController>(p, i, d, f, this, this, period);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d)
|
||||
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d)
|
||||
: Command(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d,
|
||||
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
double period)
|
||||
: Command(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
|
||||
@@ -19,7 +19,7 @@ using namespace frc;
|
||||
* @param i the integral value
|
||||
* @param d the derivative value
|
||||
*/
|
||||
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
|
||||
double d)
|
||||
: Subsystem(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
||||
@@ -35,7 +35,7 @@ PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
* @param d the derivative value
|
||||
* @param f the feedforward value
|
||||
*/
|
||||
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
|
||||
double d, double f)
|
||||
: Subsystem(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
|
||||
@@ -55,7 +55,7 @@ PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
* @param f the feedfoward value
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
|
||||
double d, double f, double period)
|
||||
: Subsystem(name) {
|
||||
m_controller =
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
#include "Commands/PrintCommand.h"
|
||||
|
||||
#include <llvm/raw_ostream.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PrintCommand::PrintCommand(const llvm::Twine& message)
|
||||
: InstantCommand("Print \"" + message + llvm::Twine('"')) {
|
||||
PrintCommand::PrintCommand(const wpi::Twine& message)
|
||||
: InstantCommand("Print \"" + message + wpi::Twine('"')) {
|
||||
m_message = message.str();
|
||||
}
|
||||
|
||||
void PrintCommand::Initialize() { llvm::outs() << m_message << '\n'; }
|
||||
void PrintCommand::Initialize() { wpi::outs() << m_message << '\n'; }
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace frc;
|
||||
*
|
||||
* @param name the name of the subsystem
|
||||
*/
|
||||
Subsystem::Subsystem(const llvm::Twine& name) {
|
||||
Subsystem::Subsystem(const wpi::Twine& name) {
|
||||
SetName(name, name);
|
||||
Scheduler::GetInstance()->RegisterSubsystem(this);
|
||||
}
|
||||
@@ -87,12 +87,12 @@ Command* Subsystem::GetDefaultCommand() {
|
||||
*
|
||||
* @return the default command name
|
||||
*/
|
||||
llvm::StringRef Subsystem::GetDefaultCommandName() {
|
||||
wpi::StringRef Subsystem::GetDefaultCommandName() {
|
||||
Command* defaultCommand = GetDefaultCommand();
|
||||
if (defaultCommand) {
|
||||
return defaultCommand->GetName();
|
||||
} else {
|
||||
return llvm::StringRef();
|
||||
return wpi::StringRef();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,12 +118,12 @@ Command* Subsystem::GetCurrentCommand() const { return m_currentCommand; }
|
||||
*
|
||||
* @return the current command name
|
||||
*/
|
||||
llvm::StringRef Subsystem::GetCurrentCommandName() const {
|
||||
wpi::StringRef Subsystem::GetCurrentCommandName() const {
|
||||
Command* currentCommand = GetCurrentCommand();
|
||||
if (currentCommand) {
|
||||
return currentCommand->GetName();
|
||||
} else {
|
||||
return llvm::StringRef();
|
||||
return wpi::StringRef();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ void Subsystem::ConfirmCommand() {
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void Subsystem::AddChild(const llvm::Twine& name,
|
||||
void Subsystem::AddChild(const wpi::Twine& name,
|
||||
std::shared_ptr<Sendable> child) {
|
||||
AddChild(name, *child);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void Subsystem::AddChild(const llvm::Twine& name,
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void Subsystem::AddChild(const llvm::Twine& name, Sendable* child) {
|
||||
void Subsystem::AddChild(const wpi::Twine& name, Sendable* child) {
|
||||
AddChild(name, *child);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void Subsystem::AddChild(const llvm::Twine& name, Sendable* child) {
|
||||
* @param name name to give child
|
||||
* @param child sendable
|
||||
*/
|
||||
void Subsystem::AddChild(const llvm::Twine& name, Sendable& child) {
|
||||
void Subsystem::AddChild(const wpi::Twine& name, Sendable& child) {
|
||||
child.SetName(GetSubsystem(), name);
|
||||
LiveWindow::GetInstance()->Add(&child);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ using namespace frc;
|
||||
* @param name the name of the command
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
*/
|
||||
TimedCommand::TimedCommand(const llvm::Twine& name, double timeout)
|
||||
TimedCommand::TimedCommand(const wpi::Twine& name, double timeout)
|
||||
: Command(name, timeout) {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,5 +23,5 @@ WaitCommand::WaitCommand(double timeout)
|
||||
*
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
*/
|
||||
WaitCommand::WaitCommand(const llvm::Twine& name, double timeout)
|
||||
WaitCommand::WaitCommand(const wpi::Twine& name, double timeout)
|
||||
: TimedCommand(name, timeout) {}
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace frc;
|
||||
WaitForChildren::WaitForChildren(double timeout)
|
||||
: Command("WaitForChildren", timeout) {}
|
||||
|
||||
WaitForChildren::WaitForChildren(const llvm::Twine& name, double timeout)
|
||||
WaitForChildren::WaitForChildren(const wpi::Twine& name, double timeout)
|
||||
: Command(name, timeout) {}
|
||||
|
||||
bool WaitForChildren::IsFinished() {
|
||||
|
||||
@@ -23,7 +23,7 @@ WaitUntilCommand::WaitUntilCommand(double time)
|
||||
m_time = time;
|
||||
}
|
||||
|
||||
WaitUntilCommand::WaitUntilCommand(const llvm::Twine& name, double time)
|
||||
WaitUntilCommand::WaitUntilCommand(const wpi::Twine& name, double time)
|
||||
: Command(name, time) {
|
||||
m_time = time;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user