mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01: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:
@@ -28,7 +28,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace llvm {
|
||||
namespace wpi {
|
||||
namespace sys {
|
||||
namespace fs {
|
||||
UniqueID file_status::getUniqueID() const {
|
||||
@@ -39,10 +39,10 @@ std::error_code current_path(SmallVectorImpl<char> &result) {
|
||||
result.clear();
|
||||
|
||||
const char *pwd = ::getenv("PWD");
|
||||
llvm::sys::fs::file_status PWDStatus, DotStatus;
|
||||
if (pwd && llvm::sys::path::is_absolute(pwd) &&
|
||||
!llvm::sys::fs::status(pwd, PWDStatus) &&
|
||||
!llvm::sys::fs::status(".", DotStatus) &&
|
||||
wpi::sys::fs::file_status PWDStatus, DotStatus;
|
||||
if (pwd && wpi::sys::path::is_absolute(pwd) &&
|
||||
!wpi::sys::fs::status(pwd, PWDStatus) &&
|
||||
!wpi::sys::fs::status(".", DotStatus) &&
|
||||
PWDStatus.getUniqueID() == DotStatus.getUniqueID()) {
|
||||
result.append(pwd, pwd + strlen(pwd));
|
||||
return std::error_code();
|
||||
@@ -387,4 +387,4 @@ void system_temp_directory(bool ErasedOnReboot, SmallVectorImpl<char> &Result) {
|
||||
|
||||
} // end namespace path
|
||||
} // end namespace sys
|
||||
} // end namespace llvm
|
||||
} // end namespace wpi
|
||||
|
||||
Reference in New Issue
Block a user