To make building preambles faster and keep them smaller.
I haven't done proper benchmarks, but here are some numbers from running this on my machine:
Sizes of preamble with (before the change) and without (after the change) functon bodies:
|All C++11 stl includes||13.15MB||8.75M|
Time to build the preamble (just a single run, not a proper benchmark):
|All C++11 stl includes||1.40s||0.80s|
Time to build AST and provide diagnostics after preamble is ready (just a single run, not a proper benchmark):
Those are some impressive numbers!
Excited to see this land, thanks for tracking down all the weird problems.
|536 ↗||(On Diff #127891)|
Nit: I think the comment/assert focus too much on the 'what' at the expense of the 'why' - just the first sentence here is probably enough (without the second and without the assert).
And below, something like:
// For the main file, we do want the AST and diagnostics for function bodies.
It could. The problem with ASTUnit is that it returns all diagnostics from store_diag_begin/end, not just the ones from the current file.
Skipping function bodies would mean no diagnostics from the preamble. Which may or may not be fine, I'm not sure how important those diagnostics are for the clients.