]> granicus.if.org Git - clang/commit
Clean up ownership of 'AttributeList' objects in Parser. Apparently
authorTed Kremenek <kremenek@apple.com>
Thu, 11 Feb 2010 02:19:13 +0000 (02:19 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 11 Feb 2010 02:19:13 +0000 (02:19 +0000)
commit1e37765c9257ef1d051f54a674eaa964bdba9693
treec52fc41c38bd124445be4f69a46e298dbede75df
parent75042398c34413594a9f5f56f5f3761ea37fd2d0
Clean up ownership of 'AttributeList' objects in Parser.  Apparently
we would just leak them all over the place, with no clear ownership of
these objects at all.  AttributeList objects would get leaked on both
error and non-error paths.

Note: I introduced the usage of llvm::OwningPtr<AttributeList> to
manage these objects, which is particularly useful for methods with
multiple return sites.  In at least one method I used them even when
they weren't strictly necessary because it clarified the ownership
semantics and made the code easier to read.  Should the excessive
'take()' and 'reset()' calls become a performance issue we can always
re-evaluate.

Note+1: I believe I have not introduced any double-frees, but it would
be nice for someone to review this.

This fixes <rdar://problem/7635046>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95847 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseObjc.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/Parser.cpp