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:
@@ -6,8 +6,8 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "support/Base64.h"
|
||||
#include "wpi/Base64.h"
|
||||
#include "wpi/SmallString.h"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -26,11 +26,11 @@ std::ostream& operator<<(std::ostream& os, const Base64TestParam& param) {
|
||||
|
||||
class Base64Test : public ::testing::TestWithParam<Base64TestParam> {
|
||||
protected:
|
||||
llvm::StringRef GetPlain() {
|
||||
StringRef GetPlain() {
|
||||
if (GetParam().plain_len < 0)
|
||||
return llvm::StringRef(GetParam().plain);
|
||||
return StringRef(GetParam().plain);
|
||||
else
|
||||
return llvm::StringRef(GetParam().plain, GetParam().plain_len);
|
||||
return StringRef(GetParam().plain, GetParam().plain_len);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ TEST_P(Base64Test, EncodeStdString) {
|
||||
}
|
||||
|
||||
TEST_P(Base64Test, EncodeSmallString) {
|
||||
llvm::SmallString<128> buf;
|
||||
SmallString<128> buf;
|
||||
ASSERT_EQ(GetParam().encoded, Base64Encode(GetPlain(), buf));
|
||||
// reuse buf
|
||||
ASSERT_EQ(GetParam().encoded, Base64Encode(GetPlain(), buf));
|
||||
@@ -53,7 +53,7 @@ TEST_P(Base64Test, EncodeSmallString) {
|
||||
|
||||
TEST_P(Base64Test, DecodeStdString) {
|
||||
std::string s;
|
||||
llvm::StringRef encoded = GetParam().encoded;
|
||||
StringRef encoded = GetParam().encoded;
|
||||
EXPECT_EQ(encoded.size(), Base64Decode(encoded, &s));
|
||||
ASSERT_EQ(GetPlain(), s);
|
||||
|
||||
@@ -63,10 +63,10 @@ TEST_P(Base64Test, DecodeStdString) {
|
||||
}
|
||||
|
||||
TEST_P(Base64Test, DecodeSmallString) {
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::StringRef encoded = GetParam().encoded;
|
||||
SmallString<128> buf;
|
||||
StringRef encoded = GetParam().encoded;
|
||||
size_t len;
|
||||
llvm::StringRef plain = Base64Decode(encoded, &len, buf);
|
||||
StringRef plain = Base64Decode(encoded, &len, buf);
|
||||
EXPECT_EQ(encoded.size(), len);
|
||||
ASSERT_EQ(GetPlain(), plain);
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "support/hostname.h"
|
||||
#include "wpi/hostname.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/SmallVector.h"
|
||||
#include "wpi/SmallString.h"
|
||||
#include "wpi/SmallVector.h"
|
||||
|
||||
namespace wpi {
|
||||
TEST(HostNameTest, HostNameNotEmpty) { ASSERT_NE(wpi::GetHostname(), ""); }
|
||||
TEST(HostNameTest, HostNameNotEmpty) { ASSERT_NE(GetHostname(), ""); }
|
||||
TEST(HostNameTest, HostNameNotEmptySmallVector) {
|
||||
llvm::SmallVector<char, 256> name;
|
||||
ASSERT_NE(wpi::GetHostname(name), "");
|
||||
SmallVector<char, 256> name;
|
||||
ASSERT_NE(GetHostname(name), "");
|
||||
}
|
||||
} // namespace wpi
|
||||
|
||||
@@ -735,7 +735,7 @@ TEST(CborFloatTest, Number)
|
||||
|
||||
TEST(CborFloatTest, HalfInfinity)
|
||||
{
|
||||
json j = json::from_cbor(llvm::StringRef("\xf9\x7c\x00", 3));
|
||||
json j = json::from_cbor(wpi::StringRef("\xf9\x7c\x00", 3));
|
||||
json::number_float_t d = j;
|
||||
EXPECT_FALSE(std::isfinite(d));
|
||||
EXPECT_EQ(j.dump(), "null");
|
||||
@@ -1138,31 +1138,31 @@ TEST(CborErrorTest, TooShortByteVector)
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor("\x19"), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x19\x00", 2)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x19\x00", 2)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor("\x1a"), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1a\x00", 2)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1a\x00", 2)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1a\x00\x00", 3)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1a\x00\x00", 3)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 4: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1a\x00\x00\x00", 4)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1a\x00\x00\x00", 4)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 5: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor("\x1b"), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00", 2)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00", 2)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00\x00", 3)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00\x00", 3)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 4: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00\x00\x00", 4)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00\x00\x00", 4)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 5: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00\x00\x00\x00", 5)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00\x00\x00\x00", 5)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 6: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00\x00\x00\x00\x00", 6)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00\x00\x00\x00\x00", 6)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 7: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00\x00\x00\x00\x00\x00", 7)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00\x00\x00\x00\x00\x00", 7)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 8: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_cbor(llvm::StringRef("\x1b\x00\x00\x00\x00\x00\x00\x00", 8)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_cbor(wpi::StringRef("\x1b\x00\x00\x00\x00\x00\x00\x00", 8)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 9: unexpected end of input");
|
||||
}
|
||||
|
||||
@@ -1547,7 +1547,7 @@ TEST(CborFirstBytesTest, Unsupported)
|
||||
|
||||
try
|
||||
{
|
||||
json::from_cbor(llvm::StringRef(&byte, 1));
|
||||
json::from_cbor(wpi::StringRef(&byte, 1));
|
||||
}
|
||||
catch (const json::parse_error& e)
|
||||
{
|
||||
@@ -1571,7 +1571,7 @@ TEST(CborFirstBytesTest, Unsupported)
|
||||
namespace {
|
||||
struct CborRoundtripTestParam {
|
||||
const char* plain;
|
||||
llvm::StringRef encoded;
|
||||
wpi::StringRef encoded;
|
||||
bool test_encode;
|
||||
};
|
||||
} // anonymous namespace
|
||||
@@ -1589,7 +1589,7 @@ TEST_P(CborRoundtripTest, Case)
|
||||
}
|
||||
|
||||
static const CborRoundtripTestParam rfc7049_appendix_a_numbers[] = {
|
||||
{"0", llvm::StringRef("\x00", 1), true},
|
||||
{"0", wpi::StringRef("\x00", 1), true},
|
||||
{"1", "\x01", true},
|
||||
{"10", "\x0a", true},
|
||||
{"23", "\x17", true},
|
||||
@@ -1597,38 +1597,38 @@ static const CborRoundtripTestParam rfc7049_appendix_a_numbers[] = {
|
||||
{"25", "\x18\x19", true},
|
||||
{"100", "\x18\x64", true},
|
||||
{"1000", "\x19\x03\xe8", true},
|
||||
{"1000000", llvm::StringRef("\x1a\x00\x0f\x42\x40", 5), true},
|
||||
{"1000000000000", llvm::StringRef("\x1b\x00\x00\x00\xe8\xd4\xa5\x10\x00", 9), true},
|
||||
{"1000000", wpi::StringRef("\x1a\x00\x0f\x42\x40", 5), true},
|
||||
{"1000000000000", wpi::StringRef("\x1b\x00\x00\x00\xe8\xd4\xa5\x10\x00", 9), true},
|
||||
{"18446744073709551615", "\x1b\xff\xff\xff\xff\xff\xff\xff\xff", true},
|
||||
// positive bignum is not supported
|
||||
//{"18446744073709551616", llvm::StringRef("\xc2\x49\x01\x00\x00\x00\x00\x00\x00\x00\x00", 11), true},
|
||||
//{"18446744073709551616", wpi::StringRef("\xc2\x49\x01\x00\x00\x00\x00\x00\x00\x00\x00", 11), true},
|
||||
//{"-18446744073709551616", "\x3b\xff\xff\xff\xff\xff\xff\xff\xff", true},
|
||||
// negative bignum is not supported
|
||||
//{"-18446744073709551617", llvm::StringRef("\xc3\x49\x01\x00\x00\x00\x00\x00\x00\x00\x00", 11), true},
|
||||
//{"-18446744073709551617", wpi::StringRef("\xc3\x49\x01\x00\x00\x00\x00\x00\x00\x00\x00", 11), true},
|
||||
{"-1", "\x20", true},
|
||||
{"-10", "\x29", true},
|
||||
{"-100", "\x38\x63", true},
|
||||
{"-1000", "\x39\x03\xe7", true},
|
||||
// half-precision float
|
||||
{"0.0", llvm::StringRef("\xf9\x00\x00", 3), false},
|
||||
{"0.0", wpi::StringRef("\xf9\x00\x00", 3), false},
|
||||
// half-precision float
|
||||
{"-0.0", llvm::StringRef("\xf9\x80\x00", 3), false},
|
||||
{"-0.0", wpi::StringRef("\xf9\x80\x00", 3), false},
|
||||
// half-precision float
|
||||
{"1.0", llvm::StringRef("\xf9\x3c\x00", 3), false},
|
||||
{"1.0", wpi::StringRef("\xf9\x3c\x00", 3), false},
|
||||
{"1.1", "\xfb\x3f\xf1\x99\x99\x99\x99\x99\x9a", true},
|
||||
// half-precision float
|
||||
{"1.5", llvm::StringRef("\xf9\x3e\x00", 3), false},
|
||||
{"1.5", wpi::StringRef("\xf9\x3e\x00", 3), false},
|
||||
// half-precision float
|
||||
{"65504.0", "\xf9\x7b\xff", false},
|
||||
{"100000.0", llvm::StringRef("\xfa\x47\xc3\x50\x00", 5), false},
|
||||
{"100000.0", wpi::StringRef("\xfa\x47\xc3\x50\x00", 5), false},
|
||||
{"3.4028234663852886e+38", "\xfa\x7f\x7f\xff\xff", false},
|
||||
{"1.0e+300", llvm::StringRef("\xfb\x7e\x37\xe4\x3c\x88\x00\x75\x9c", 9), true},
|
||||
{"1.0e+300", wpi::StringRef("\xfb\x7e\x37\xe4\x3c\x88\x00\x75\x9c", 9), true},
|
||||
// half-precision float
|
||||
{"5.960464477539063e-8", llvm::StringRef("\xf9\x00\x01", 3), false},
|
||||
{"5.960464477539063e-8", wpi::StringRef("\xf9\x00\x01", 3), false},
|
||||
// half-precision float
|
||||
{"0.00006103515625", llvm::StringRef("\xf9\x04\x00", 3), false},
|
||||
{"0.00006103515625", wpi::StringRef("\xf9\x04\x00", 3), false},
|
||||
// half-precision float
|
||||
{"-4.0", llvm::StringRef("\xf9\xc4\x00", 3), false},
|
||||
{"-4.0", wpi::StringRef("\xf9\xc4\x00", 3), false},
|
||||
{"-4.1", "\xfb\xc0\x10\x66\x66\x66\x66\x66\x66", true},
|
||||
};
|
||||
|
||||
|
||||
@@ -34,11 +34,10 @@ SOFTWARE.
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "llvm/SmallString.h"
|
||||
#include "wpi/SmallString.h"
|
||||
|
||||
#include "unit-json.h"
|
||||
|
||||
#include "support/json_serializer.h"
|
||||
#include "json_serializer.h"
|
||||
|
||||
using wpi::json;
|
||||
|
||||
@@ -68,11 +67,11 @@ class JsonStringEscapeTest
|
||||
: public ::testing::TestWithParam<std::pair<const char*, const char*>> {};
|
||||
TEST_P(JsonStringEscapeTest, Case)
|
||||
{
|
||||
llvm::SmallString<32> buf;
|
||||
llvm::raw_svector_ostream ss(buf);
|
||||
wpi::SmallString<32> buf;
|
||||
wpi::raw_svector_ostream ss(buf);
|
||||
json::serializer s(ss);
|
||||
s.dump_escaped(GetParam().first);
|
||||
EXPECT_EQ(ss.str(), llvm::StringRef(GetParam().second));
|
||||
EXPECT_EQ(ss.str(), wpi::StringRef(GetParam().second));
|
||||
}
|
||||
|
||||
static const std::pair<const char*, const char*> string_escape_cases[] = {
|
||||
|
||||
@@ -35,7 +35,7 @@ SOFTWARE.
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "unit-json.h"
|
||||
#include "support/raw_istream.h"
|
||||
#include "wpi/raw_istream.h"
|
||||
using wpi::json;
|
||||
|
||||
#include <valarray>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include "support/json.h"
|
||||
#include "wpi/json.h"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
|
||||
@@ -1008,31 +1008,31 @@ TEST(MessagePackErrorTest, TooShortByteVector)
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack("\xcd"), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcd\x00", 2)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcd\x00", 2)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack("\xce"), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xce\x00", 2)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xce\x00", 2)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xce\x00\x00", 3)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xce\x00\x00", 3)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 4: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xce\x00\x00\x00", 4)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xce\x00\x00\x00", 4)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 5: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack("\xcf"), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 2: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00", 2)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00", 2)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 3: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00\x00", 3)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00\x00", 3)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 4: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00\x00\x00", 4)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00\x00\x00", 4)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 5: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00\x00\x00\x00", 5)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00\x00\x00\x00", 5)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 6: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00\x00\x00\x00\x00", 6)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00\x00\x00\x00\x00", 6)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 7: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00\x00\x00\x00\x00\x00", 7)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00\x00\x00\x00\x00\x00", 7)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 8: unexpected end of input");
|
||||
EXPECT_THROW_MSG(json::from_msgpack(llvm::StringRef("\xcf\x00\x00\x00\x00\x00\x00\x00", 8)), json::parse_error,
|
||||
EXPECT_THROW_MSG(json::from_msgpack(wpi::StringRef("\xcf\x00\x00\x00\x00\x00\x00\x00", 8)), json::parse_error,
|
||||
"[json.exception.parse_error.110] parse error at 9: unexpected end of input");
|
||||
}
|
||||
|
||||
|
||||
@@ -124,14 +124,14 @@ TEST(JsonReadmeTest, FromToString)
|
||||
|
||||
// explicit conversion to string
|
||||
std::string s;
|
||||
llvm::raw_string_ostream os(s);
|
||||
wpi::raw_string_ostream os(s);
|
||||
j.dump(os); // {\"happy\":true,\"pi\":3.141}
|
||||
EXPECT_EQ(os.str(), "{\"happy\":true,\"pi\":3.141}");
|
||||
|
||||
// serialization with pretty printing
|
||||
// pass in the amount of spaces to indent
|
||||
std::string s2;
|
||||
llvm::raw_string_ostream os2(s2);
|
||||
wpi::raw_string_ostream os2(s2);
|
||||
j2.dump(os2, 4);
|
||||
EXPECT_EQ(os2.str(), "{\n \"happy\": true,\n \"pi\": 3.141\n}");
|
||||
// {
|
||||
@@ -149,7 +149,7 @@ TEST(JsonReadmeTest, Basic2)
|
||||
j.push_back(true);
|
||||
|
||||
std::string s;
|
||||
llvm::raw_string_ostream os(s);
|
||||
wpi::raw_string_ostream os(s);
|
||||
|
||||
// iterate the array
|
||||
for (json::iterator it = j.begin(); it != j.end(); ++it)
|
||||
@@ -198,7 +198,7 @@ TEST(JsonReadmeTest, OtherContainer)
|
||||
{
|
||||
std::vector<int> c_vector {1, 2, 3, 4};
|
||||
json j_vec(c_vector);
|
||||
json j_vec2(llvm::makeArrayRef(c_vector));
|
||||
json j_vec2(wpi::makeArrayRef(c_vector));
|
||||
// [1, 2, 3, 4]
|
||||
|
||||
std::deque<float> c_deque {1.2f, 2.3f, 3.4f, 5.6f};
|
||||
|
||||
@@ -37,8 +37,8 @@ SOFTWARE.
|
||||
#include "unit-json.h"
|
||||
using wpi::json;
|
||||
|
||||
#include "llvm/Format.h"
|
||||
#include "llvm/StringExtras.h"
|
||||
#include "wpi/Format.h"
|
||||
#include "wpi/StringExtras.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -90,18 +90,18 @@ using wpi::json;
|
||||
|
||||
error:
|
||||
auto result = ::testing::AssertionFailure();
|
||||
result << basemsg << " with {" << llvm::utohexstr(byte1);
|
||||
result << basemsg << " with {" << wpi::utohexstr(byte1);
|
||||
if (byte2 != -1)
|
||||
{
|
||||
result << ',' << llvm::utohexstr(byte2);
|
||||
result << ',' << wpi::utohexstr(byte2);
|
||||
}
|
||||
if (byte3 != -1)
|
||||
{
|
||||
result << ',' << llvm::utohexstr(byte3);
|
||||
result << ',' << wpi::utohexstr(byte3);
|
||||
}
|
||||
if (byte4 != -1)
|
||||
{
|
||||
result << ',' << llvm::utohexstr(byte4);
|
||||
result << ',' << wpi::utohexstr(byte4);
|
||||
}
|
||||
result << '}';
|
||||
return result;
|
||||
@@ -919,8 +919,8 @@ static std::string codepoint_to_unicode(std::size_t cp)
|
||||
// by four hexadecimal digits that encode the character's code
|
||||
// point
|
||||
std::string s;
|
||||
llvm::raw_string_ostream ss(s);
|
||||
ss << "\\u" << llvm::format_hex_no_prefix(cp, 4);
|
||||
wpi::raw_string_ostream ss(s);
|
||||
ss << "\\u" << wpi::format_hex_no_prefix(cp, 4);
|
||||
ss.flush();
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -19,21 +19,21 @@
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/StringRef.h"
|
||||
#include "support/leb128.h"
|
||||
#include "support/raw_istream.h"
|
||||
#include "wpi/SmallString.h"
|
||||
#include "wpi/StringRef.h"
|
||||
#include "wpi/leb128.h"
|
||||
#include "wpi/raw_istream.h"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
TEST(LEB128Test, WriteUleb128) {
|
||||
#define EXPECT_ULEB128_EQ(EXPECTED, VALUE, PAD) \
|
||||
do { \
|
||||
llvm::StringRef expected(EXPECTED, sizeof(EXPECTED) - 1); \
|
||||
llvm::SmallString<32> buf; \
|
||||
size_t size = WriteUleb128(buf, VALUE); \
|
||||
EXPECT_EQ(size, buf.size()); \
|
||||
EXPECT_EQ(expected, buf.str()); \
|
||||
#define EXPECT_ULEB128_EQ(EXPECTED, VALUE, PAD) \
|
||||
do { \
|
||||
StringRef expected(EXPECTED, sizeof(EXPECTED) - 1); \
|
||||
SmallString<32> buf; \
|
||||
size_t size = WriteUleb128(buf, VALUE); \
|
||||
EXPECT_EQ(size, buf.size()); \
|
||||
EXPECT_EQ(expected, buf.str()); \
|
||||
} while (0)
|
||||
|
||||
// Write ULEB128
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <support/priority_condition_variable.h>
|
||||
#include <support/priority_mutex.h>
|
||||
#include <wpi/priority_condition_variable.h>
|
||||
#include <wpi/priority_mutex.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <support/priority_mutex.h> // NOLINT(build/include_order)
|
||||
#include <wpi/priority_mutex.h> // NOLINT(build/include_order)
|
||||
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "support/sha1.h"
|
||||
#include "wpi/sha1.h"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user