Add HLSLExternalSemaSource as ExternalSemaSource instead of ASTContext::ExternalSource when PCH is included.
This allows a different external source to be set for the AST context.
Differential D132421
[HLSL] Support PCH for cc1 mode python3kgae on Aug 22 2022, 5:01 PM. Authored by
Details Add HLSLExternalSemaSource as ExternalSemaSource instead of ASTContext::ExternalSource when PCH is included. This allows a different external source to be set for the AST context.
Diff Detail
Event TimelineComment Actions This change doesn't look like it is NFC to me. If I'm understanding correctly it results in the HLSLExternalSemaSource being set for Sema, but allows a different external source to be set for the AST context. That doesn't seem unreasonable to me, but perhaps we should have a test case that verifies that it works correctly? Perhaps a test case with a PCH that uses something populated by the HLSL external source? That would demonstrate that the AST source for the PCH works and that it doesn't interfere with the HLSL source. Comment Actions When there's no external source set, add HLSLSema as ExternalSource so ASTWriter can access HLSLSema.
Comment Actions Looping @aaron.ballman in here too. I think we need some eyes from outside our team on this before landing it. Comment Actions Remove useless code since ExternalSource is not be reused when there're more than one Input files.
Comment Actions One small nit, otherwise looks good.
|
This seems off. The multi source should always have at least two external sema sources.
Is there any situation where the HLSL sema would already be added?