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 "JpegUtil.h"
#include <support/raw_istream.h>
#include <wpi/raw_istream.h>
namespace cs {
@@ -49,7 +49,7 @@ static const unsigned char dhtData[] = {
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa};
bool IsJpeg(llvm::StringRef data) {
bool IsJpeg(wpi::StringRef data) {
if (data.size() < 11) return false;
// Check for valid SOI
@@ -58,7 +58,7 @@ bool IsJpeg(llvm::StringRef data) {
return true;
}
bool GetJpegSize(llvm::StringRef data, int* width, int* height) {
bool GetJpegSize(wpi::StringRef data, int* width, int* height) {
if (!IsJpeg(data)) return false;
data = data.substr(2); // Get to the first block
@@ -82,7 +82,7 @@ bool GetJpegSize(llvm::StringRef data, int* width, int* height) {
}
bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) {
llvm::StringRef sdata(data, *size);
wpi::StringRef sdata(data, *size);
if (!IsJpeg(sdata)) return false;
*locSOF = *size;
@@ -109,8 +109,8 @@ bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) {
return false;
}
llvm::StringRef JpegGetDHT() {
return llvm::StringRef(reinterpret_cast<const char*>(dhtData),
wpi::StringRef JpegGetDHT() {
return wpi::StringRef(reinterpret_cast<const char*>(dhtData),
sizeof(dhtData));
}