diff options
| author | Lang Hames <lhames@gmail.com> | 2020-12-29 20:27:41 +1100 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2020-12-30 12:48:20 +1100 |
| commit | 5efc71e119d4eba235209d262e7d171361a0b9be (patch) | |
| tree | c4a9d9908786aa274b68163fd80ee70cfa2e37f6 /llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp | |
| parent | 8a1f1a100cce6ed9b52aedbbf03da887833508be (diff) | |
| download | llvm-5efc71e119d4eba235209d262e7d171361a0b9be.zip llvm-5efc71e119d4eba235209d262e7d171361a0b9be.tar.gz llvm-5efc71e119d4eba235209d262e7d171361a0b9be.tar.bz2 | |
[ORC] Move Orc RPC code into Shared, rename some RPC types.
Moves all headers from Orc/RPC to Orc/Shared, and from the llvm::orc::rpc
namespace into llvm::orc::shared. Also renames RPCTypeName to
SerializationTypeName and Function to RPCFunction.
In addition to being a more reasonable home for this code, this will make it
easier for the upcoming Orc runtime to re-use the Serialization system for
creating and parsing wrapper-function binary blobs.
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp')
| -rw-r--r-- | llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp index 734511b..1ad13e8 100644 --- a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h" +#include "llvm/ExecutionEngine/Orc/Shared/RPCUtils.h" #include "QueueChannel.h" #include "gtest/gtest.h" @@ -14,19 +14,18 @@ using namespace llvm; using namespace llvm::orc; -using namespace llvm::orc::rpc; +using namespace llvm::orc::shared; class RPCFoo {}; namespace llvm { namespace orc { -namespace rpc { +namespace shared { - template <> - class RPCTypeName<RPCFoo> { - public: - static const char* getName() { return "RPCFoo"; } - }; +template <> class SerializationTypeName<RPCFoo> { +public: + static const char *getName() { return "RPCFoo"; } +}; template <> class SerializationTraits<QueueChannel, RPCFoo, RPCFoo> { @@ -40,7 +39,7 @@ namespace rpc { } }; -} // end namespace rpc + } // namespace shared } // end namespace orc } // end namespace llvm @@ -96,65 +95,64 @@ void registerDummyErrorSerialization() { namespace llvm { namespace orc { -namespace rpc { +namespace shared { - template <> - class SerializationTraits<QueueChannel, RPCFoo, RPCBar> { - public: - static Error serialize(QueueChannel&, const RPCBar&) { - return Error::success(); - } +template <> class SerializationTraits<QueueChannel, RPCFoo, RPCBar> { +public: + static Error serialize(QueueChannel &, const RPCBar &) { + return Error::success(); + } - static Error deserialize(QueueChannel&, RPCBar&) { - return Error::success(); - } + static Error deserialize(QueueChannel &, RPCBar &) { + return Error::success(); + } }; -} // end namespace rpc +} // end namespace shared } // end namespace orc } // end namespace llvm namespace DummyRPCAPI { - class VoidBool : public Function<VoidBool, void(bool)> { - public: - static const char* getName() { return "VoidBool"; } - }; - - class IntInt : public Function<IntInt, int32_t(int32_t)> { - public: - static const char* getName() { return "IntInt"; } - }; +class VoidBool : public RPCFunction<VoidBool, void(bool)> { +public: + static const char *getName() { return "VoidBool"; } +}; - class VoidString : public Function<VoidString, void(std::string)> { - public: - static const char* getName() { return "VoidString"; } - }; +class IntInt : public RPCFunction<IntInt, int32_t(int32_t)> { +public: + static const char *getName() { return "IntInt"; } +}; - class AllTheTypes - : public Function<AllTheTypes, void(int8_t, uint8_t, int16_t, uint16_t, - int32_t, uint32_t, int64_t, uint64_t, - bool, std::string, std::vector<int>, - std::set<int>, std::map<int, bool>)> { - public: - static const char* getName() { return "AllTheTypes"; } - }; +class VoidString : public RPCFunction<VoidString, void(std::string)> { +public: + static const char *getName() { return "VoidString"; } +}; - class CustomType : public Function<CustomType, RPCFoo(RPCFoo)> { - public: - static const char* getName() { return "CustomType"; } - }; +class AllTheTypes + : public RPCFunction<AllTheTypes, + void(int8_t, uint8_t, int16_t, uint16_t, int32_t, + uint32_t, int64_t, uint64_t, bool, std::string, + std::vector<int>, std::set<int>, + std::map<int, bool>)> { +public: + static const char *getName() { return "AllTheTypes"; } +}; - class ErrorFunc : public Function<ErrorFunc, Error()> { - public: - static const char* getName() { return "ErrorFunc"; } - }; +class CustomType : public RPCFunction<CustomType, RPCFoo(RPCFoo)> { +public: + static const char *getName() { return "CustomType"; } +}; - class ExpectedFunc : public Function<ExpectedFunc, Expected<uint32_t>()> { - public: - static const char* getName() { return "ExpectedFunc"; } - }; +class ErrorFunc : public RPCFunction<ErrorFunc, Error()> { +public: + static const char *getName() { return "ErrorFunc"; } +}; +class ExpectedFunc : public RPCFunction<ExpectedFunc, Expected<uint32_t>()> { +public: + static const char *getName() { return "ExpectedFunc"; } +}; } class DummyRPCEndpoint : public SingleThreadedRPCEndpoint<QueueChannel> { |
