This is an archive of the discontinued LLVM Phabricator instance.

[MS] Fix late-parsed template infinite loop in eager instantiation
ClosedPublic

Authored by rnk on Mar 23 2018, 1:57 PM.

Details

Summary

This fixes PR33561 and PR34185.

Don't store pending template instantiations for late-parsed templates in
the normal PendingInstantiations queue. Instead, use a separate list
that will only be parsed and instantiated at end of TU when late
template parsing actually works and doesn't infinite loop.

Diff Detail

Repository
rC Clang

Event Timeline

rnk created this revision.Mar 23 2018, 1:57 PM
rsmith added inline comments.Mar 23 2018, 2:16 PM
clang/lib/Sema/Sema.cpp
855 ↗(On Diff #139648)

In the TUPrefix case, we'll need to write these instantiations to the PCH file.

rnk updated this revision to Diff 139663.Mar 23 2018, 3:42 PM
  • make late-parsed templates pending at end of TU prefix
clang/lib/Sema/Sema.cpp
855 ↗(On Diff #139648)

I think this addresses that. Now that we are at global scope, nobody will eagerly attempt to instantiate everything on the pending instantiation queue until end of TU.

rsmith accepted this revision.Mar 23 2018, 5:14 PM
rsmith added inline comments.
clang/lib/Sema/Sema.cpp
855 ↗(On Diff #139648)

Subtle, but I agree. Thanks!

This revision is now accepted and ready to land.Mar 23 2018, 5:14 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.