[Lldb-commits] [PATCH] D33167: Get rid of some uses of StringConvert and reduce some indentation

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat May 13 22:58:40 PDT 2017

zturner created this revision.

The goal here is to eventually delete the `StringConvert` class, as the llvm APIs for doing string to number conversion have a cleaner syntax.

In order to reduce code churn, since I was in this code anyway, I changed the deeply nested indentation of the code blocks I was touching to use early outs.  This led me to get annoyed by the fact that every time we want to return something, it has to be 3 or 4 lines of code to open a scope, set the correct status on the error, set the message, eventually return, and then add another line of code to close the scope.  We should be able to do all this in one line to further reduce boilerplate goo.  So I added some code to `Status` to do this.  Whereas before we would have to write this:

  if (!succeed) {
    result.AppendError("some error");
    return result.Succeeded();

which is 5 lines of code, now we only have to write:

  if (!success)
    return result.AppendError(eStatusFailed, "some error");

which is only 2 lines.

There are more occurrences of `StringConvert` to change, but I wanted to get the feedback out of the way first before I go and do the rest.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33167.98909.patch
Type: text/x-patch
Size: 29746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170514/cbcda74f/attachment-0001.bin>

More information about the lldb-commits mailing list