Skip to content

Commit 5a22a1d

Browse files
committed
[clang][Sema] Attempt to parse delayed templates at the end of the TU
1 parent a7f1910 commit 5a22a1d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

clang/lib/Sema/Sema.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,17 @@ void Sema::ActOnEndOfTranslationUnit() {
12511251
if (LateTemplateParserCleanup)
12521252
LateTemplateParserCleanup(OpaqueParser);
12531253

1254+
if (LangOpts.DelayedTemplateParsing) {
1255+
// Try to parse any templates that have been delayed and never
1256+
// instantiated so that their bodies are available for static
1257+
// analysis tools to analyze.
1258+
Diags.setSuppressAllDiagnostics(true);
1259+
for (auto &[Decl, Template] : LateParsedTemplateMap)
1260+
if (Decl->isLateTemplateParsed())
1261+
LateTemplateParser(OpaqueParser, *Template);
1262+
Diags.setSuppressAllDiagnostics(false);
1263+
}
1264+
12541265
CheckDelayedMemberExceptionSpecs();
12551266
} else {
12561267
// If we are building a TU prefix for serialization, it is safe to transfer

0 commit comments

Comments
 (0)