Prior to establishing IWYU conventions with the release of version 4.15, UE4 code typically included a PCH file at the top of every CPP file, which is contrary to what a developer
wants their IWYU compliant code to include. With the newly-established IWYU conventions, PCH files can be thought of as layers of compile-time optizations that are applied separately from
how the code was originally authored. So, rather than composing and including PCH files, we leave it to UBT to decide which PCH file to use (if any).
If you want to enable IWYU mode, ensuring that a module complies with IWYU conventions, open the module's *.build.cs file and set
PCHUsageMode.UseExplicitOrSharedPCHs creates an explicit PCH file for a module only if it has a
PrivatePCHHeaderFile setting in the module's *.build.cs file.
Otherwise, the module will share a PCH with another module, saving the tool from generating more PCH files than necessary. Also, keep in mind that when you enable
mode, the source file must include its matching header file. Alternatively, if you want a module to opt-out of complying with IWYU conventions, you can set
After converting the engine's code base to an IWYU model, we've observed significant improvements with UE4 compile times.