[Lldb-commits] [lldb] r144741 - in /lldb/trunk/source/Expression: IRDynamicChecks.cpp IRForTarget.cpp

Eric Christopher echristo at apple.com
Tue Nov 15 16:31:09 PST 2011


On Nov 15, 2011, at 4:20 PM, Sean Callanan wrote:

> +            if (!strcmp(name_cstr, "objc_msgSend"))
> +            {
>                 RegisterInstruction(i);
> +                msgSend_types[&i] = eMsgSend;
> +                return true;
> +            }
> +            

...

> +            if (!strcmp(name_cstr, "objc_msgSendSuper_stret"))
> +            {
> +                RegisterInstruction(i);
> +                msgSend_types[&i] = eMsgSendSuper_stret;
> +                return true;
> +            }

For this kind of code you could use the llvm::StringSwitch and it'd look like:

msgSend_types[&i] = llvm::StringSwitch<enum XXX>(name_cstr)
                                   .case("objc_msgSend", eMsgSend)
                                   …
                                   .Default(eMsgUnknown)

if (msgSend_types[&I] != eMsgUnknown)
	RegisterInstruction(i)
else
	log(…)

return true;

and probably save you some duplicated code :)

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20111115/c36e3432/attachment.html>


More information about the lldb-commits mailing list