facebook/xctool — pull request #110 by kcoons (2013-07-19 23:01:07+00:00)
Title: Add source context to exceptions and analyzer warnings

Added context for exceptions and analyzer warnings. A few comments/questions:
* The analyzer already shows a single line of context at build time. Is that from clang? Sure would be nice if I could just swipe what it's doing.
* On a similar note, if the code on disk is modified from the code that was built and is being run, then the context will be incorrect. Do we have access to symbols created during the build? I'd rather use something like that than the text hacking in getContext, but I have no clue how to access them.
* Exceptions appear twice, once during the run and once in a summary at the bottom. I added context only during the run, but am happy to change that.
* The analyzer warnings have two parts, a summary at the top of each warning, and a (possibly multi-part) set of details that led to the problem. I added context only for the summary because it was a bit overwhelming if it showed for all of the details. But, the details are a lot more useful with the context. So, happy to change this too.

Test Plan:
* Ran TestProject-Library with run-tests and verified output (screenshot attached)
* Modified test so that context crosses 2-digit to 3-digit line number boundary and verified output
* Modified test so that exception line has trailing whitespace and verified output
* Modified test to have a trailing comment and verified output -- the comment gets underlined. Oh well?
* Added an analyzer warning and verified the output
* Modified test to contain only 2 lines of code and verified output
* Modified test to contain a really long line of code and verified output. The underline looks weird due to word wrap, but otherwise ok.
* Ran the analyzer on xctool. It claims there's a potential memory leak in TaskUtil.m :) This also shows what the analyzer looks like with lots and lots of details (screenshot attached)

![run_tests](https://f.cloud.github.com/assets/2028444/828980/6c5f64f0-f0c3-11e2-9fbb-9f5a0785daf1.png)
![analyze_xctool](https://f.cloud.github.com/assets/2028444/828979/66bbceee-f0c3-11e2-9ae4-b9bf4d223a89.png)