- Make sure main file includes are present even when they're not patched (because they didn't change or we're explicitly not patching them).
- Populate extra fields for includes, which can be used by include-cleaner.
Code looks reasonable, but I don't understand why the changes are being made - can you explain/link to a bug in the commit message?
This doesn't seem related to the patch description, can you update it?
why the null check?
seems a bit more future-proof to copy the whole thing and just overwrite the fields you want to preserve. (also would avoid the need for the comment)
this just echoes the code - say why instead?
(would also be good to have the reason in the commit message)
- Address comments & update commit message
as discussed offline, we might have includes coming from scanned contents whose are not part of the preamble, e.g. because they're in a disabled PP region.
if It->second is null, then all the #includes of this header from the baseline preamble were in disabled sections, so it's *very* likely this one is too.
I think we're better not pushing onto PP.PreambleIncludes at all in this case, rather than pushing an unresolved one - this is how the MainFileIncludes looks like when an #include is in a disabled section and there's no patching happening.