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

@@ -7,7 +7,7 @@
#include <stdint.h>
#include <support/timestamp.h>
#include <wpi/timestamp.h>
#include "Value_internal.h"
#include "networktables/NetworkTableValue.h"
@@ -42,7 +42,7 @@ Value::~Value() {
delete[] m_val.data.arr_string.arr;
}
std::shared_ptr<Value> Value::MakeBooleanArray(llvm::ArrayRef<int> value,
std::shared_ptr<Value> Value::MakeBooleanArray(wpi::ArrayRef<int> value,
uint64_t time) {
auto val = std::make_shared<Value>(NT_BOOLEAN_ARRAY, time, private_init());
val->m_val.data.arr_boolean.arr = new int[value.size()];
@@ -51,7 +51,7 @@ std::shared_ptr<Value> Value::MakeBooleanArray(llvm::ArrayRef<int> value,
return val;
}
std::shared_ptr<Value> Value::MakeDoubleArray(llvm::ArrayRef<double> value,
std::shared_ptr<Value> Value::MakeDoubleArray(wpi::ArrayRef<double> value,
uint64_t time) {
auto val = std::make_shared<Value>(NT_DOUBLE_ARRAY, time, private_init());
val->m_val.data.arr_double.arr = new double[value.size()];
@@ -60,7 +60,7 @@ std::shared_ptr<Value> Value::MakeDoubleArray(llvm::ArrayRef<double> value,
return val;
}
std::shared_ptr<Value> Value::MakeStringArray(llvm::ArrayRef<std::string> value,
std::shared_ptr<Value> Value::MakeStringArray(wpi::ArrayRef<std::string> value,
uint64_t time) {
auto val = std::make_shared<Value>(NT_STRING_ARRAY, time, private_init());
val->m_string_array = value;
@@ -142,7 +142,7 @@ void nt::ConvertToC(const Value& in, NT_Value* out) {
out->type = in.type();
}
void nt::ConvertToC(llvm::StringRef in, NT_String* out) {
void nt::ConvertToC(wpi::StringRef in, NT_String* out) {
out->len = in.size();
out->str = static_cast<char*>(std::malloc(in.size() + 1));
std::memcpy(out->str, in.data(), in.size());
@@ -164,10 +164,10 @@ std::shared_ptr<Value> nt::ConvertFromC(const NT_Value& value) {
case NT_RPC:
return Value::MakeRpc(ConvertFromC(value.data.v_raw));
case NT_BOOLEAN_ARRAY:
return Value::MakeBooleanArray(llvm::ArrayRef<int>(
return Value::MakeBooleanArray(wpi::ArrayRef<int>(
value.data.arr_boolean.arr, value.data.arr_boolean.size));
case NT_DOUBLE_ARRAY:
return Value::MakeDoubleArray(llvm::ArrayRef<double>(
return Value::MakeDoubleArray(wpi::ArrayRef<double>(
value.data.arr_double.arr, value.data.arr_double.size));
case NT_STRING_ARRAY: {
std::vector<std::string> v;