[ORC] Fix out-of-range comparison errors.
authorLang Hames <lhames@gmail.com>
Sun, 12 Sep 2021 04:47:20 +0000 (14:47 +1000)
committerLang Hames <lhames@gmail.com>
Sun, 12 Sep 2021 04:48:05 +0000 (14:48 +1000)
llvm/include/llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h
llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp

index 7d1df16..84da111 100644 (file)
@@ -34,8 +34,7 @@ extern const char *DispatchFnName;
 } // end namespace SimpleRemoteEPCDefaultBootstrapSymbolNames
 
 enum class SimpleRemoteEPCOpcode : uint8_t {
-  FirstOpC,
-  Setup = FirstOpC,
+  Setup,
   Hangup,
   Result,
   CallWrapper,
index d60a6a2..0405c3b 100644 (file)
@@ -157,8 +157,7 @@ SimpleRemoteEPC::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
                                ExecutorAddress TagAddr,
                                SimpleRemoteEPCArgBytesVector ArgBytes) {
   using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
-  if (static_cast<UT>(OpC) < static_cast<UT>(SimpleRemoteEPCOpcode::FirstOpC) ||
-      static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
+  if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
     return make_error<StringError>("Unexpected opcode",
                                    inconvertibleErrorCode());
 
index d3180cc..ce341ff 100644 (file)
@@ -169,8 +169,7 @@ SimpleRemoteEPCServer::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
                                      ExecutorAddress TagAddr,
                                      SimpleRemoteEPCArgBytesVector ArgBytes) {
   using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
-  if (static_cast<UT>(OpC) < static_cast<UT>(SimpleRemoteEPCOpcode::FirstOpC) ||
-      static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
+  if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
     return make_error<StringError>("Unexpected opcode",
                                    inconvertibleErrorCode());