This is an archive of the discontinued LLVM Phabricator instance.

Classes inside lambdas are local not nested.
ClosedPublic

Authored by sepavloff on Jul 7 2015, 11:06 AM.

Details

Summary

If a lambda used as default argument in a method declaration contained
a local class, that class was incorrectly recognized as nested class.
In this case compiler tried to postpone parsing of this class until
the enclosing class is finished, which caused crashes in some cases.

This change fixes PR13987.

Diff Detail

Repository
rL LLVM

Event Timeline

sepavloff updated this revision to Diff 29194.Jul 7 2015, 11:06 AM
sepavloff retitled this revision from to Classes inside lambdas are local not nested..
sepavloff updated this object.

Would this fix PR23860?

Yes, it fixes PR23860 also.

Thanks,
--Serge

rsmith added a subscriber: rsmith.Jul 7 2015, 12:55 PM
rsmith added inline comments.
lib/Parse/ParseDeclCXX.cpp
2822–2829 ↗(On Diff #29194)

Do we need to check the parent scope here at all? (Why can't we just break immediately once we reach a function scope?)

sepavloff added inline comments.Jul 8 2015, 12:51 AM
lib/Parse/ParseDeclCXX.cpp
2822–2829 ↗(On Diff #29194)

I cannot invent a case where this check would require inspection of parent. Will remove it.

sepavloff updated this revision to Diff 29246.Jul 8 2015, 12:55 AM

Simplified check, organized tests.

Ping.

Thanks,
--Serge

rsmith accepted this revision.Jul 13 2015, 12:34 PM
rsmith added a reviewer: rsmith.

Thanks, LGTM

This revision is now accepted and ready to land.Jul 13 2015, 12:34 PM
This revision was automatically updated to reflect the committed changes.