================
@@ -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:
Are you saying the lexical decl context of an instantiation should be the same
with the template? If yes, I feel it is incorrect. I think the lexical decl
context should show the lexical context of a decl literally.
---
BTW, I do think the modules ownership and decl context ownership are two
distinct problems. And if you can solve two of them in a consistent manner, it
is good. But it is good too to solve one standalone.
My attitude to such "fundamental" problems is: yes, it is always good to fix
them fundamentally. But it is also good to do some adhoc mix to stop bleeding
first. So the ordering in my mind can be:
landing this patch as a fix -> fix the fundamental problems you described ->
revert this patch
I don't feel it will be problematic.
https://github.com/llvm/llvm-project/pull/126842
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits