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:
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Path.h"
|
||||
#include "wpi/Path.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
@@ -22,14 +22,14 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "llvm/FileSystem.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "wpi/FileSystem.h"
|
||||
#include "wpi/SmallString.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace wpi;
|
||||
|
||||
namespace {
|
||||
using llvm::StringRef;
|
||||
using llvm::sys::path::is_separator;
|
||||
using wpi::StringRef;
|
||||
using wpi::sys::path::is_separator;
|
||||
|
||||
#ifdef _WIN32
|
||||
const char *separators = "\\/";
|
||||
@@ -148,7 +148,7 @@ namespace {
|
||||
}
|
||||
} // end unnamed namespace
|
||||
|
||||
namespace llvm {
|
||||
namespace wpi {
|
||||
namespace sys {
|
||||
namespace path {
|
||||
|
||||
@@ -626,7 +626,7 @@ static SmallString<256> remove_dots(StringRef path, bool remove_dot_dot) {
|
||||
|
||||
// Skip the root path, then look for traversal in the components.
|
||||
StringRef rel = path::relative_path(path);
|
||||
for (StringRef C : llvm::make_range(path::begin(rel), path::end(rel))) {
|
||||
for (StringRef C : wpi::make_range(path::begin(rel), path::end(rel))) {
|
||||
if (C == ".")
|
||||
continue;
|
||||
if (remove_dot_dot) {
|
||||
@@ -795,7 +795,7 @@ std::error_code directory_entry::status(file_status &result) const {
|
||||
|
||||
} // end namespace fs
|
||||
} // end namespace sys
|
||||
} // end namespace llvm
|
||||
} // end namespace wpi
|
||||
|
||||
// Include the truly platform-specific parts.
|
||||
#ifdef _WIN32
|
||||
@@ -804,7 +804,7 @@ std::error_code directory_entry::status(file_status &result) const {
|
||||
#include "Unix/Path.inc"
|
||||
#endif
|
||||
|
||||
namespace llvm {
|
||||
namespace wpi {
|
||||
namespace sys {
|
||||
namespace path {
|
||||
|
||||
@@ -819,4 +819,4 @@ bool user_cache_directory(SmallVectorImpl<char> &Result, const Twine &Path1,
|
||||
|
||||
} // end namespace path
|
||||
} // end namsspace sys
|
||||
} // end namespace llvm
|
||||
} // end namespace wpi
|
||||
|
||||
Reference in New Issue
Block a user