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 "Error.h"
#include <llvm/Path.h>
#include <wpi/Path.h>
#include "DriverStation.h"
#include "Timer.h"
@@ -41,8 +41,8 @@ const ErrorBase* Error::GetOriginatingObject() const {
double Error::GetTimestamp() const { return m_timestamp; }
void Error::Set(Code code, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
void Error::Set(Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber, const ErrorBase* originatingObject) {
bool report = true;
@@ -66,8 +66,8 @@ void Error::Set(Code code, const llvm::Twine& contextMessage,
void Error::Report() {
DriverStation::ReportError(
true, m_code, m_message,
m_function + llvm::Twine(" [") + llvm::sys::path::filename(m_filename) +
llvm::Twine(':') + llvm::Twine(m_lineNumber) + llvm::Twine(']'),
m_function + wpi::Twine(" [") + wpi::sys::path::filename(m_filename) +
wpi::Twine(':') + wpi::Twine(m_lineNumber) + wpi::Twine(']'),
GetStackTrace(4));
}