Handle delayed-template-parsing functions imported into a non-dtp TU
authorSam McCall <sam.mccall@gmail.com>
Tue, 9 Jun 2020 15:13:34 +0000 (17:13 +0200)
committerSam McCall <sam.mccall@gmail.com>
Fri, 12 Jun 2020 14:09:38 +0000 (16:09 +0200)
commit05ed3efc2ac7b34bd62b1cbac88ff9a47b649cc5
treea7186795197e14c664d68b059ce200e9f7ae6c09
parentf52e4129a7c748421543d6572806dfec2407bbd3
Handle delayed-template-parsing functions imported into a non-dtp TU

Summary:
DelayedTemplateParsing is marked as BENIGN_LANGOPT, so we are allowed to
use a delayed template in a non-delayed TU.
(This is clangd's default configuration on windows: delayed-template-parsing
is on for the preamble and forced off for the current file)

However today clang fails to parse implicit instantiations in a non-dtp
TU of templates defined in a dtp PCH file (and presumably module?).
In this case the delayed parser is not registered, so the function is
simply marked "delayed" again. We then hit an assert:
end of TU template instantiation should not create more late-parsed templates

Reviewers: rsmith

Subscribers: ilya-biryukov, usaxena95, cfe-commits, kadircet

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81474
clang/lib/Parse/Parser.cpp
clang/test/PCH/delayed-template-parsing.cpp [new file with mode: 0644]