From: Reid Kleckner Date: Thu, 27 Feb 2014 22:51:43 +0000 (+0000) Subject: MS ABI: Attempt to fix DenseMap entry reference invalidation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e229d2b0b2161ac4dd0ae832061915afd721b1d;p=clang MS ABI: Attempt to fix DenseMap entry reference invalidation git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202441 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/VTableBuilder.h b/include/clang/AST/VTableBuilder.h index dee91c7581..b1acad3200 100644 --- a/include/clang/AST/VTableBuilder.h +++ b/include/clang/AST/VTableBuilder.h @@ -485,7 +485,7 @@ private: MethodVFTableLocationsTy; MethodVFTableLocationsTy MethodVFTableLocations; - typedef llvm::DenseMap + typedef llvm::DenseMap VFPtrLocationsMapTy; VFPtrLocationsMapTy VFPtrLocations; diff --git a/lib/AST/VTableBuilder.cpp b/lib/AST/VTableBuilder.cpp index f12313e643..1531614c8f 100644 --- a/lib/AST/VTableBuilder.cpp +++ b/lib/AST/VTableBuilder.cpp @@ -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 &