]> granicus.if.org Git - clang/commitdiff
MS ABI: Attempt to fix DenseMap entry reference invalidation
authorReid Kleckner <reid@kleckner.net>
Thu, 27 Feb 2014 22:51:43 +0000 (22:51 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 27 Feb 2014 22:51:43 +0000 (22:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202441 91177308-0d34-0410-b5e6-96231b3b80d8

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

index dee91c7581a7ec01c0a653eb8e71796391295ac8..b1acad3200b2e517e630e7795b1a405df97ac6d0 100644 (file)
@@ -485,7 +485,7 @@ private:
     MethodVFTableLocationsTy;
   MethodVFTableLocationsTy MethodVFTableLocations;
 
-  typedef llvm::DenseMap<const CXXRecordDecl *, VPtrInfoVector>
+  typedef llvm::DenseMap<const CXXRecordDecl *, VPtrInfoVector *>
     VFPtrLocationsMapTy;
   VFPtrLocationsMapTy VFPtrLocations;
 
index f12313e6439aa272ef2c93698d3e14b165f94e01..1531614c8f8683c5518321828ab2a5e0ecd3eea2 100644 (file)
@@ -3387,11 +3387,12 @@ void MicrosoftVTableContext::computeVTableRelatedInformation(
 
   const VTableLayout::AddressPointsMapTy EmptyAddressPointsMap;
 
-  VPtrInfoVector &VFPtrs = VFPtrLocations[RD];
-  computeVTablePaths(/*ForVBTables=*/false, RD, VFPtrs);
+  VPtrInfoVector *VFPtrs = new VPtrInfoVector();
+  computeVTablePaths(/*ForVBTables=*/false, RD, *VFPtrs);
+  VFPtrLocations[RD] = VFPtrs;
 
   MethodVFTableLocationsTy NewMethodLocations;
-  for (VPtrInfoVector::iterator I = VFPtrs.begin(), E = VFPtrs.end();
+  for (VPtrInfoVector::iterator I = VFPtrs->begin(), E = VFPtrs->end();
        I != E; ++I) {
     VFTableBuilder Builder(*this, RD, *I);
 
@@ -3530,7 +3531,7 @@ MicrosoftVTableContext::getVFPtrOffsets(const CXXRecordDecl *RD) {
   computeVTableRelatedInformation(RD);
 
   assert(VFPtrLocations.count(RD) && "Couldn't find vfptr locations");
-  return VFPtrLocations[RD];
+  return *VFPtrLocations[RD];
 }
 
 const VTableLayout &