[PATCH] D26435: Use unique_ptr for cached tokens for default arguments in C++.

David Tarditi via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 17:19:31 PST 2016


dtarditi created this revision.
dtarditi added a subscriber: cfe-commits.

This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs.  There was a fixme in the code where the cached tokens are created  about using a smart pointer.

The change is straightforward, though I did have to track down and fix a memory corruption caused by the change.  memcpy was being used to copy parameter information.  This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely.


https://reviews.llvm.org/D26435

Files:
  include/clang/Parse/Parser.h
  include/clang/Sema/DeclSpec.h
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDeclCXX.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26435.77289.patch
Type: text/x-patch
Size: 7161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161109/7f6e828e/attachment.bin>


More information about the cfe-commits mailing list