<div dir="ltr">Good idea. Fixed in r258203. Thanks Philip!<div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 19, 2016 at 12:10 PM, Philip Reames <span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Minor, but could you add a #undef after the switch to make the scope of the macro explicit?<span class="HOEnZb"><font color="#888888"><br>
<br>
Philip</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 01/15/2016 03:19 PM, Lang Hames via llvm-commits wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: lhames<br>
Date: Fri Jan 15 17:19:06 2016<br>
New Revision: 257951<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=257951&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=257951&view=rev</a><br>
Log:<br>
[Orc] Replace switch cases with a macro.<br>
<br>
The cases of this switch are all perfectly regular (except for the first case).<br>
A macro is more readable here.<br>
<br>
Thanks to Dave Blaikie for the suggestion.<br>
<br>
Modified:<br>
llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp?rev=257951&r1=257950&r2=257951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp?rev=257951&r1=257950&r2=257951&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp Fri Jan 15 17:19:06 2016<br>
@@ -9,6 +9,10 @@<br>
#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h"<br>
+#define PROCNAME(X) \<br>
+ case X ## Id: \<br>
+ return #X<br>
+<br>
namespace llvm {<br>
namespace orc {<br>
namespace remote {<br>
@@ -17,68 +21,37 @@ const char *OrcRemoteTargetRPCAPI::getJI<br>
switch (Id) {<br>
case InvalidId:<br>
return "*** Invalid JITProcId ***";<br>
- case CallIntVoidId:<br>
- return "CallIntVoid";<br>
- case CallIntVoidResponseId:<br>
- return "CallIntVoidResponse";<br>
- case CallMainId:<br>
- return "CallMain";<br>
- case CallMainResponseId:<br>
- return "CallMainResponse";<br>
- case CallVoidVoidId:<br>
- return "CallVoidVoid";<br>
- case CallVoidVoidResponseId:<br>
- return "CallVoidVoidResponse";<br>
- case CreateRemoteAllocatorId:<br>
- return "CreateRemoteAllocator";<br>
- case CreateIndirectStubsOwnerId:<br>
- return "CreateIndirectStubsOwner";<br>
- case DeregisterEHFramesId:<br>
- return "DeregisterEHFrames";<br>
- case DestroyRemoteAllocatorId:<br>
- return "DestroyRemoteAllocator";<br>
- case DestroyIndirectStubsOwnerId:<br>
- return "DestroyIndirectStubsOwner";<br>
- case EmitIndirectStubsId:<br>
- return "EmitIndirectStubs";<br>
- case EmitIndirectStubsResponseId:<br>
- return "EmitIndirectStubsResponse";<br>
- case EmitResolverBlockId:<br>
- return "EmitResolverBlock";<br>
- case EmitTrampolineBlockId:<br>
- return "EmitTrampolineBlock";<br>
- case EmitTrampolineBlockResponseId:<br>
- return "EmitTrampolineBlockResponse";<br>
- case GetSymbolAddressId:<br>
- return "GetSymbolAddress";<br>
- case GetSymbolAddressResponseId:<br>
- return "GetSymbolAddressResponse";<br>
- case GetRemoteInfoId:<br>
- return "GetRemoteInfo";<br>
- case GetRemoteInfoResponseId:<br>
- return "GetRemoteInfoResponse";<br>
- case ReadMemId:<br>
- return "ReadMem";<br>
- case ReadMemResponseId:<br>
- return "ReadMemResponse";<br>
- case RegisterEHFramesId:<br>
- return "RegisterEHFrames";<br>
- case ReserveMemId:<br>
- return "ReserveMem";<br>
- case ReserveMemResponseId:<br>
- return "ReserveMemResponse";<br>
- case RequestCompileId:<br>
- return "RequestCompile";<br>
- case RequestCompileResponseId:<br>
- return "RequestCompileResponse";<br>
- case SetProtectionsId:<br>
- return "SetProtections";<br>
- case TerminateSessionId:<br>
- return "TerminateSession";<br>
- case WriteMemId:<br>
- return "WriteMem";<br>
- case WritePtrId:<br>
- return "WritePtr";<br>
+ PROCNAME(CallIntVoid);<br>
+ PROCNAME(CallIntVoidResponse);<br>
+ PROCNAME(CallMain);<br>
+ PROCNAME(CallMainResponse);<br>
+ PROCNAME(CallVoidVoid);<br>
+ PROCNAME(CallVoidVoidResponse);<br>
+ PROCNAME(CreateRemoteAllocator);<br>
+ PROCNAME(CreateIndirectStubsOwner);<br>
+ PROCNAME(DeregisterEHFrames);<br>
+ PROCNAME(DestroyRemoteAllocator);<br>
+ PROCNAME(DestroyIndirectStubsOwner);<br>
+ PROCNAME(EmitIndirectStubs);<br>
+ PROCNAME(EmitIndirectStubsResponse);<br>
+ PROCNAME(EmitResolverBlock);<br>
+ PROCNAME(EmitTrampolineBlock);<br>
+ PROCNAME(EmitTrampolineBlockResponse);<br>
+ PROCNAME(GetSymbolAddress);<br>
+ PROCNAME(GetSymbolAddressResponse);<br>
+ PROCNAME(GetRemoteInfo);<br>
+ PROCNAME(GetRemoteInfoResponse);<br>
+ PROCNAME(ReadMem);<br>
+ PROCNAME(ReadMemResponse);<br>
+ PROCNAME(RegisterEHFrames);<br>
+ PROCNAME(ReserveMem);<br>
+ PROCNAME(ReserveMemResponse);<br>
+ PROCNAME(RequestCompile);<br>
+ PROCNAME(RequestCompileResponse);<br>
+ PROCNAME(SetProtections);<br>
+ PROCNAME(TerminateSession);<br>
+ PROCNAME(WriteMem);<br>
+ PROCNAME(WritePtr);<br>
};<br>
return nullptr;<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>