[PATCH] D132421: [HLSL] Support PCH for cc1 mode
Xiang Li via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 31 21:52:03 PDT 2022
python3kgae marked an inline comment as done.
python3kgae added inline comments.
================
Comment at: clang/include/clang/Sema/HLSLExternalSemaSource.h:58
+/// them before we initialize the ExternalSemaSource base class.
+struct ChainedHLSLExternalSemaSourceMembers {
+ ChainedHLSLExternalSemaSourceMembers(ExternalSemaSource *ExtSema)
----------------
beanz wrote:
> python3kgae wrote:
> > beanz wrote:
> > > IIUC, this code just exists to make sure that the `ASTReader` deserializes before the external sema source starts adding things. Is that correct?
> > >
> > > If so, you don't need to do this, instead you can just add this code to `InitializeSema()` to force the `ASTReader` to de-serialize the decls:
> > >
> > > ```
> > > // If the translation unit has external storage force external decls to load.
> > > if (AST.getTranslationUnitDecl()->hasExternalLexicalStorage())
> > > (void)AST.getTranslationUnitDecl()->decls_begin();
> > > ```
> > Still need this to make sure HLSLSema and ExternalSema are initialized before MultiplexExternalSemaSource.
> In FrontendAction, where you are creating the Chained source, you can instead create a Multiplex source, and put the PCH external source in as the first source and the HLSL one second. The PCH will get initialized first, the HLSL one can force the PCH one to populate the decls.
Asked how to resolve the issue in https://discourse.llvm.org/t/is-it-possible-for-multiplexexternalsemasource-to-own-the-sources/64990
Hope someone can explain why multiplexexternalsemasource doesn't own the Sources.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132421/new/
https://reviews.llvm.org/D132421
More information about the cfe-commits
mailing list