[PATCH] D25423: Use unique_ptr for VTableBuilder::VFTableLayouts map.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 9 22:24:24 PDT 2016


jlebar created this revision.
jlebar added a reviewer: timshen.
jlebar added a subscriber: cfe-commits.

https://reviews.llvm.org/D25423

Files:
  clang/include/clang/AST/VTableBuilder.h
  clang/lib/AST/VTableBuilder.cpp


Index: clang/lib/AST/VTableBuilder.cpp
===================================================================
--- clang/lib/AST/VTableBuilder.cpp
+++ clang/lib/AST/VTableBuilder.cpp
@@ -3389,7 +3389,6 @@
 }
 
 MicrosoftVTableContext::~MicrosoftVTableContext() {
-  llvm::DeleteContainerSeconds(VFTableLayouts);
   llvm::DeleteContainerSeconds(VBaseInfo);
 }
 
@@ -3592,7 +3591,7 @@
     assert(VFTableLayouts.count(id) == 0);
     SmallVector<VTableLayout::VTableThunkTy, 1> VTableThunks(
         Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
-    VFTableLayouts[id] = new VTableLayout(
+    VFTableLayouts[id] = llvm::make_unique<VTableLayout>(
         Builder.getNumVTableComponents(), Builder.vtable_component_begin(),
         VTableThunks.size(), VTableThunks.data(), EmptyAddressPointsMap, true);
     Thunks.insert(Builder.thunks_begin(), Builder.thunks_end());
Index: clang/include/clang/AST/VTableBuilder.h
===================================================================
--- clang/include/clang/AST/VTableBuilder.h
+++ clang/include/clang/AST/VTableBuilder.h
@@ -480,7 +480,8 @@
   VFPtrLocationsMapTy VFPtrLocations;
 
   typedef std::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
-  typedef llvm::DenseMap<VFTableIdTy, const VTableLayout *> VFTableLayoutMapTy;
+  typedef llvm::DenseMap<VFTableIdTy, std::unique_ptr<const VTableLayout>>
+      VFTableLayoutMapTy;
   VFTableLayoutMapTy VFTableLayouts;
 
   llvm::DenseMap<const CXXRecordDecl *, VirtualBaseInfo *> VBaseInfo;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25423.74101.patch
Type: text/x-patch
Size: 1510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161010/50dd766b/attachment.bin>


More information about the cfe-commits mailing list