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

@@ -13,12 +13,12 @@
#include <utility>
#include <vector>
#include <llvm/ArrayRef.h>
#include <llvm/SmallVector.h>
#include <llvm/Twine.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/Twine.h>
#include "SendableBuilder.h"
@@ -73,74 +73,74 @@ class SendableBuilderImpl : public SendableBuilder {
*/
void StopLiveWindowMode();
void SetSmartDashboardType(const llvm::Twine& type) override;
void SetSmartDashboardType(const wpi::Twine& type) override;
void SetSafeState(std::function<void()> func) override;
void SetUpdateTable(std::function<void()> func) override;
nt::NetworkTableEntry GetEntry(const llvm::Twine& key) override;
nt::NetworkTableEntry GetEntry(const wpi::Twine& key) override;
void AddBooleanProperty(const llvm::Twine& key, std::function<bool()> getter,
void AddBooleanProperty(const wpi::Twine& key, std::function<bool()> getter,
std::function<void(bool)> setter) override;
void AddDoubleProperty(const llvm::Twine& key, std::function<double()> getter,
void AddDoubleProperty(const wpi::Twine& key, std::function<double()> getter,
std::function<void(double)> setter) override;
void AddStringProperty(const llvm::Twine& key,
void AddStringProperty(const wpi::Twine& key,
std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) override;
std::function<void(wpi::StringRef)> setter) override;
void AddBooleanArrayProperty(
const llvm::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(llvm::ArrayRef<int>)> setter) override;
const wpi::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) override;
void AddDoubleArrayProperty(
const llvm::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(llvm::ArrayRef<double>)> setter) override;
const wpi::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) override;
void AddStringArrayProperty(
const llvm::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) override;
const wpi::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
void AddRawProperty(const llvm::Twine& key,
void AddRawProperty(const wpi::Twine& key,
std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) override;
std::function<void(wpi::StringRef)> setter) override;
void AddValueProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<std::shared_ptr<nt::Value>()> getter,
std::function<void(std::shared_ptr<nt::Value>)> setter) override;
void AddSmallStringProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) override;
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) override;
void AddSmallBooleanArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<int>(llvm::SmallVectorImpl<int>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<void(llvm::ArrayRef<int>)> setter) override;
std::function<void(wpi::ArrayRef<int>)> setter) override;
void AddSmallDoubleArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<double>(llvm::SmallVectorImpl<double>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(llvm::ArrayRef<double>)> setter) override;
std::function<void(wpi::ArrayRef<double>)> setter) override;
void AddSmallStringArrayProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<
llvm::ArrayRef<std::string>(llvm::SmallVectorImpl<std::string>& buf)>
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) override;
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
void AddSmallRawProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) override;
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) override;
private:
struct Property {
Property(nt::NetworkTable& table, const llvm::Twine& key)
Property(nt::NetworkTable& table, const wpi::Twine& key)
: entry(table.GetEntry(key)) {}
Property(const Property&) = delete;