Macro expansion SLocEntries are significant to PCH size (7-10% in my tests).
These store the expansion end location as vbr8. However it's highly predictable:
- for macro arg expansion it's zero
- for object macros it equals the expansion start
- for function macros it's usually shortly after the expansion start
Instead, this change stores (bool relative, unsigned value).
If relative is true, ExpEnd is ExpBegin+value, otherwise it's just value.
We define abbreviations to cover the common cases above.
This saves ~15% of SM_SLOC_EXPANSION, which is 1-1.5% of overall PCH size.
NIT: maybe avoid the lambda? The code is short enough to be readable without early returns: