diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-02-13 17:12:20 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-02-13 17:14:58 +0800 |
commit | 24ecd99842352ed1e6d7877e76e93c2f83ebf3f3 (patch) | |
tree | e047fabd245c876e1c7ea5c867c9503b5c4865e7 /clang/lib/Frontend/ASTUnit.cpp | |
parent | 19659b5f0dd1a1dcf745cf058d042ada2d4ff061 (diff) | |
download | llvm-24ecd99842352ed1e6d7877e76e93c2f83ebf3f3.zip llvm-24ecd99842352ed1e6d7877e76e93c2f83ebf3f3.tar.gz llvm-24ecd99842352ed1e6d7877e76e93c2f83ebf3f3.tar.bz2 |
[NFC] Set C++20 Named Modules for CodeGen in ASTContext in the early place
Previously we'll set the named modules for ASTContext in ParseAST. But
this is not intuitive and we need comments to tell the intuition. This
patch moves the code the right the place, where the corrresponding
module is first created/loaded. Now it is more intuitive and we can use
the value in the earlier places.
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 3b4f251..f2939a2 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -877,6 +877,10 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( PP.setCounterValue(Counter); + Module *M = HeaderInfo.lookupModule(AST->getLangOpts().CurrentModule); + if (M && AST->getLangOpts().isCompilingModule() && M->isModulePurview()) + AST->Ctx->setNamedModuleForCodeGen(M); + // Create an AST consumer, even though it isn't used. if (ToLoad >= LoadASTOnly) AST->Consumer.reset(new ASTConsumer); |