<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 15, 2011, at 4:20 PM, Sean Callanan wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">+            if (!strcmp(name_cstr, "objc_msgSend"))<br>+            {<br>                RegisterInstruction(i);<br>+                msgSend_types[&i] = eMsgSend;<br>+                return true;<br>+            }<br>+            <br></span></blockquote><div><br></div><div>...</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">+            if (!strcmp(name_cstr, "objc_msgSendSuper_stret"))<br>+            {<br>+                RegisterInstruction(i);<br>+                msgSend_types[&i] = eMsgSendSuper_stret;<br>+                return true;<br>+            }<br></span></blockquote></div><br><div>For this kind of code you could use the llvm::StringSwitch and it'd look like:</div><div><br></div><div>msgSend_types[&i] = llvm::StringSwitch<enum XXX>(name_cstr)</div><div>                                   .case("objc_msgSend", eMsgSend)</div><div>                                   …</div><div>                                   .Default(eMsgUnknown)</div><div><br></div><div>if (msgSend_types[&I] != eMsgUnknown)</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>RegisterInstruction(i)</div><div>else</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>log(…)</div><div><br></div><div>return true;</div><div><br></div><div>and probably save you some duplicated code :)</div><div><br></div><div>-eric</div></body></html>