Page MenuHomePhabricator

[Sema] Fix a use-after-deallocate of a ParsedAttr

Authored by erik.pilkington on Apr 1 2019, 3:26 PM.



moveAttrFromListToList only makes sense when moving an attribute to a list with a pool that's either equivalent, or has a shorter lifetime. Therefore, using it to move a ParsedAttr from a declarator to a declaration specifier doesn't make sense, since the declaration specifier's pool outlives the declarator's. The patch adds a new function, ParsedAttributes::takeOneFrom, which transfers the attribute from one pool to another, fixing the use-after-deallocate.


Thanks for taking a look!

Diff Detail

rC Clang

Event Timeline

erik.pilkington created this revision.Apr 1 2019, 3:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2019, 3:26 PM
aaron.ballman accepted this revision.Apr 2 2019, 7:46 AM

LGTM aside from some minor nits. Thanks for this!

896 ↗(On Diff #193185)

How about Attrs and PA to fit with usual naming conventions?

291 ↗(On Diff #193185)

Can you add a comment here that explains what this test is intending to cover?

This revision is now accepted and ready to land.Apr 2 2019, 7:46 AM
This revision was automatically updated to reflect the committed changes.