]> granicus.if.org Git - clang/commit
[Sema] Fix a use-after-deallocate of a ParsedAttr
authorErik Pilkington <erik.pilkington@gmail.com>
Tue, 2 Apr 2019 19:48:11 +0000 (19:48 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Tue, 2 Apr 2019 19:48:11 +0000 (19:48 +0000)
commiteba82fe884767c65d881c0f636fd0ecebfd64ca8
tree44a427ac1518f0dc9a88ae8f3f63e3a600d71e6e
parent115a5521a197ac5f71719d573cd81a235a30fcf7
[Sema] Fix a use-after-deallocate of a ParsedAttr

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.

rdar://49175426

Differential revision: https://reviews.llvm.org/D60101

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357516 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/ParsedAttr.h
lib/Sema/SemaType.cpp
test/SemaObjC/arc-property-decl-attrs.m