[ORC] Re-apply 286620 with fixes for the ErrorSuccess class.

llvm-svn: 286639
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
index c95532e..718b99e 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
@@ -14,7 +14,7 @@
 #ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
 #define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
 
-#include "llvm/ExecutionEngine/Orc/RPCByteChannel.h"
+#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
 #include <mutex>
 
@@ -25,7 +25,7 @@
 #endif
 
 /// RPC channel that reads from and writes from file descriptors.
-class FDRPCChannel final : public llvm::orc::remote::RPCByteChannel {
+class FDRPCChannel final : public llvm::orc::rpc::RawByteChannel {
 public:
   FDRPCChannel(int InFD, int OutFD) : InFD(InFD), OutFD(OutFD) {}
 
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
index 9c21098..f5a06cf 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
@@ -1265,8 +1265,8 @@
   BinopPrecedence['*'] = 40; // highest.
 
   auto TCPChannel = connect();
-  MyRemote Remote = ExitOnErr(MyRemote::Create(*TCPChannel));
-  TheJIT = llvm::make_unique<KaleidoscopeJIT>(Remote);
+  auto Remote = ExitOnErr(MyRemote::Create(*TCPChannel));
+  TheJIT = llvm::make_unique<KaleidoscopeJIT>(*Remote);
 
   // Automatically inject a definition for 'printExprResult'.
   FunctionProtos["printExprResult"] =
@@ -1288,7 +1288,7 @@
   TheJIT = nullptr;
 
   // Send a terminate message to the remote to tell it to exit cleanly.
-  ExitOnErr(Remote.terminateSession());
+  ExitOnErr(Remote->terminateSession());
 
   return 0;
 }