aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index b3fba09..93a2d79 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1105,9 +1105,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();
return;
+ }
// Transfer late parsed template instantiations over to the pending template
// instantiation list. During normal compilation, the late template parser