[clang] [C++20] [Modules] Instantiate pending instantiations when GMF ends (PR #126842)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 19 02:46:50 PST 2025
================
@@ -1104,9 +1104,13 @@ void Sema::ActOnStartOfTranslationUnit() {
}
void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) {
- // No explicit actions are required at the end of the global module fragment.
- if (Kind == TUFragmentKind::Global)
+ if (Kind == TUFragmentKind::Global) {
+ // Perform Pending Instantiations at the end of global module fragment so
+ // that the module ownership of TU-level decls won't get messed.
+ llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");
+ PerformPendingInstantiations();
----------------
ChuanqiXu9 wrote:
Got it. But maybe not so simple since we will change the module owner ship when setting the decl context. And this is the reason why the modules ownership is incorrect in this example.
https://github.com/llvm/llvm-project/pull/126842
More information about the cfe-commits
mailing list