[llvm] r257951 - [Orc] Replace switch cases with a macro.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 15:19:07 PST 2016
Author: lhames
Date: Fri Jan 15 17:19:06 2016
New Revision: 257951
URL: http://llvm.org/viewvc/llvm-project?rev=257951&view=rev
Log:
[Orc] Replace switch cases with a macro.
The cases of this switch are all perfectly regular (except for the first case).
A macro is more readable here.
Thanks to Dave Blaikie for the suggestion.
Modified:
llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp?rev=257951&r1=257950&r2=257951&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp Fri Jan 15 17:19:06 2016
@@ -9,6 +9,10 @@
#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h"
+#define PROCNAME(X) \
+ case X ## Id: \
+ return #X
+
namespace llvm {
namespace orc {
namespace remote {
@@ -17,68 +21,37 @@ const char *OrcRemoteTargetRPCAPI::getJI
switch (Id) {
case InvalidId:
return "*** Invalid JITProcId ***";
- case CallIntVoidId:
- return "CallIntVoid";
- case CallIntVoidResponseId:
- return "CallIntVoidResponse";
- case CallMainId:
- return "CallMain";
- case CallMainResponseId:
- return "CallMainResponse";
- case CallVoidVoidId:
- return "CallVoidVoid";
- case CallVoidVoidResponseId:
- return "CallVoidVoidResponse";
- case CreateRemoteAllocatorId:
- return "CreateRemoteAllocator";
- case CreateIndirectStubsOwnerId:
- return "CreateIndirectStubsOwner";
- case DeregisterEHFramesId:
- return "DeregisterEHFrames";
- case DestroyRemoteAllocatorId:
- return "DestroyRemoteAllocator";
- case DestroyIndirectStubsOwnerId:
- return "DestroyIndirectStubsOwner";
- case EmitIndirectStubsId:
- return "EmitIndirectStubs";
- case EmitIndirectStubsResponseId:
- return "EmitIndirectStubsResponse";
- case EmitResolverBlockId:
- return "EmitResolverBlock";
- case EmitTrampolineBlockId:
- return "EmitTrampolineBlock";
- case EmitTrampolineBlockResponseId:
- return "EmitTrampolineBlockResponse";
- case GetSymbolAddressId:
- return "GetSymbolAddress";
- case GetSymbolAddressResponseId:
- return "GetSymbolAddressResponse";
- case GetRemoteInfoId:
- return "GetRemoteInfo";
- case GetRemoteInfoResponseId:
- return "GetRemoteInfoResponse";
- case ReadMemId:
- return "ReadMem";
- case ReadMemResponseId:
- return "ReadMemResponse";
- case RegisterEHFramesId:
- return "RegisterEHFrames";
- case ReserveMemId:
- return "ReserveMem";
- case ReserveMemResponseId:
- return "ReserveMemResponse";
- case RequestCompileId:
- return "RequestCompile";
- case RequestCompileResponseId:
- return "RequestCompileResponse";
- case SetProtectionsId:
- return "SetProtections";
- case TerminateSessionId:
- return "TerminateSession";
- case WriteMemId:
- return "WriteMem";
- case WritePtrId:
- return "WritePtr";
+ PROCNAME(CallIntVoid);
+ PROCNAME(CallIntVoidResponse);
+ PROCNAME(CallMain);
+ PROCNAME(CallMainResponse);
+ PROCNAME(CallVoidVoid);
+ PROCNAME(CallVoidVoidResponse);
+ PROCNAME(CreateRemoteAllocator);
+ PROCNAME(CreateIndirectStubsOwner);
+ PROCNAME(DeregisterEHFrames);
+ PROCNAME(DestroyRemoteAllocator);
+ PROCNAME(DestroyIndirectStubsOwner);
+ PROCNAME(EmitIndirectStubs);
+ PROCNAME(EmitIndirectStubsResponse);
+ PROCNAME(EmitResolverBlock);
+ PROCNAME(EmitTrampolineBlock);
+ PROCNAME(EmitTrampolineBlockResponse);
+ PROCNAME(GetSymbolAddress);
+ PROCNAME(GetSymbolAddressResponse);
+ PROCNAME(GetRemoteInfo);
+ PROCNAME(GetRemoteInfoResponse);
+ PROCNAME(ReadMem);
+ PROCNAME(ReadMemResponse);
+ PROCNAME(RegisterEHFrames);
+ PROCNAME(ReserveMem);
+ PROCNAME(ReserveMemResponse);
+ PROCNAME(RequestCompile);
+ PROCNAME(RequestCompileResponse);
+ PROCNAME(SetProtections);
+ PROCNAME(TerminateSession);
+ PROCNAME(WriteMem);
+ PROCNAME(WritePtr);
};
return nullptr;
}
More information about the llvm-commits
mailing list