Allow to selectively skip function bodies while parsing.

Hi,

I would like to upstream the attached patch which allows ASTConsumer to select
which function to skip while parsing.

I have been using it to do a online code browser: http://code.woboq.org

Most of the time of my tool is spent in parsing.
And I have to parse the same includes again and again, and some includes have
a lot of inline functions.
By skipping body in already seen includes, I was able to reduce the parsing
time by 30%.

This might also be useful for other tools like refactoring or so.

Regards,

0001-Add-a-hook-in-the-ASTConsumer-to-be-able-to-skip-fun.patch (1.56 KB)

Thanks, the patch looks good. Please add a test; unittests/Tooling/ToolingTest.cpp would be a reasonable fit. You could test this by using a test case containing a function with an error in its body, and ensure that your hook allows you to control when the parser hits the error.

+Argyrios, who I believe added the current skip support.

LGTM.

Committed with some minor style tweaks as r168726.