[cfe-commits] r154748 - in /cfe/trunk: include/clang/AST/VTableBuilder.h lib/AST/VTableBuilder.cpp

Benjamin Kramer benny.kra at googlemail.com
Sat Apr 14 07:13:43 PDT 2012


Author: d0k
Date: Sat Apr 14 09:13:43 2012
New Revision: 154748

URL: http://llvm.org/viewvc/llvm-project?rev=154748&view=rev
Log:
Replace manual delete[] with OwningArrayPtr.

Modified:
    cfe/trunk/include/clang/AST/VTableBuilder.h
    cfe/trunk/lib/AST/VTableBuilder.cpp

Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=154748&r1=154747&r2=154748&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Sat Apr 14 09:13:43 2012
@@ -205,11 +205,11 @@
   typedef llvm::DenseMap<BaseSubobject, uint64_t> AddressPointsMapTy;
 private:
   uint64_t NumVTableComponents;
-  VTableComponent *VTableComponents;
+  llvm::OwningArrayPtr<VTableComponent> VTableComponents;
 
   /// VTableThunks - Contains thunks needed by vtables.
   uint64_t NumVTableThunks;
-  VTableThunkTy *VTableThunks;
+  llvm::OwningArrayPtr<VTableThunkTy> VTableThunks;
 
   /// Address points - Address points for all vtables.
   AddressPointsMapTy AddressPoints;
@@ -227,11 +227,11 @@
   }
 
   vtable_component_iterator vtable_component_begin() const {
-   return VTableComponents;
+   return VTableComponents.get();
   }
 
   vtable_component_iterator vtable_component_end() const {
-   return VTableComponents+NumVTableComponents;
+   return VTableComponents.get()+NumVTableComponents;
   }
 
   uint64_t getNumVTableThunks() const {
@@ -239,11 +239,11 @@
   }
 
   vtable_thunk_iterator vtable_thunk_begin() const {
-   return VTableThunks;
+   return VTableThunks.get();
   }
 
   vtable_thunk_iterator vtable_thunk_end() const {
-   return VTableThunks+NumVTableThunks;
+   return VTableThunks.get()+NumVTableThunks;
   }
 
   uint64_t getAddressPoint(BaseSubobject Base) const {

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=154748&r1=154747&r2=154748&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Sat Apr 14 09:13:43 2012
@@ -2157,14 +2157,12 @@
     VTableThunks(new VTableThunkTy[NumVTableThunks]),
     AddressPoints(AddressPoints) {
   std::copy(VTableComponents, VTableComponents+NumVTableComponents,
-            this->VTableComponents);
-  std::copy(VTableThunks, VTableThunks+NumVTableThunks, this->VTableThunks);
+            this->VTableComponents.get());
+  std::copy(VTableThunks, VTableThunks+NumVTableThunks,
+            this->VTableThunks.get());
 }
 
-VTableLayout::~VTableLayout() {
-  delete[] VTableComponents;
-  delete[] VTableThunks;
-}
+VTableLayout::~VTableLayout() { }
 
 VTableContext::~VTableContext() {
   llvm::DeleteContainerSeconds(VTableLayouts);





More information about the cfe-commits mailing list