This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Prevent InstantiateClass from checking unrelated exception specs.
ClosedPublic

Authored by vsapsai on Sep 14 2017, 6:42 PM.

Details

Summary

Sema::InstantiateClass should check only exception specs added during
class instantiation and ignore already present delayed specs. This fixes
a case where we instantiate a class before parsing member initializers,
check exceptions for a different class and fail to find a member
initializer. Which is required for comparing exception specs for
explicitly-defaulted and implicit default constructor. With the fix we
are still checking exception specs but only after member initializers
are present.

Removing errors in crash-unparsed-exception.cpp is acceptable according
to discussion in PR24000 because other compilers accept code in
crash-unparsed-exception.cpp as valid.

rdar://problem/34167492

Cc Dimitry Andric due to participation in discussion about PR24000.

Diff Detail

Repository
rL LLVM

Event Timeline

vsapsai created this revision.Sep 14 2017, 6:42 PM

I don't like name SavePendingDelayedStateRAII as too vague. Hope you'll be able to suggest something better or I'll have better ideas later.

rsmith accepted this revision.Sep 19 2017, 1:45 PM

I don't like name SavePendingDelayedStateRAII as too vague. Hope you'll be able to suggest something better or I'll have better ideas later.

I like everything about this patch other than the name of the class :)

I think we need to clearly identify what state we're saving here and why. It's the state that is pending from a class that we're currently in the middle of parsing, so how about something like SavePendingParsedClassStateRAII?

This revision is now accepted and ready to land.Sep 19 2017, 1:45 PM

Thanks for review.

I think we need to clearly identify what state we're saving here and why. It's the state that is pending from a class that we're currently in the middle of parsing, so how about something like SavePendingParsedClassStateRAII?

Agree with suggested name, will use it and will clarify comment about "Some delayed state".

vsapsai updated this revision to Diff 116056.Sep 20 2017, 12:45 PM
  • Rename SavePendingDelayedStateRAII to SavePendingParsedClassStateRAII.
This revision was automatically updated to reflect the committed changes.