From: Ken Dyck Date: Thu, 7 Apr 2011 00:55:01 +0000 (+0000) Subject: Reapply r128770. It's not the cause of the issues Devang saw with debug info. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d28c33caf38aadae30473ba04ad67e88bece5938;p=clang Reapply r128770. It's not the cause of the issues Devang saw with debug info. Use CharUnits for the offsets in the VBaseOffsetOffsetsMapTy types. No change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129043 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index fb945a8b61..ec3f420386 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -706,7 +706,7 @@ CharUnits VCallOffsetMap::getVCallOffsetOffset(const CXXMethodDecl *MD) { /// VCallAndVBaseOffsetBuilder - Class for building vcall and vbase offsets. class VCallAndVBaseOffsetBuilder { public: - typedef llvm::DenseMap + typedef llvm::DenseMap VBaseOffsetOffsetsMapTy; private: @@ -937,7 +937,7 @@ VCallAndVBaseOffsetBuilder::AddVBaseOffsets(const CXXRecordDecl *RD, CharUnits VBaseOffsetOffset = getCurrentOffsetOffset(); VBaseOffsetOffsets.insert( - std::make_pair(BaseDecl, VBaseOffsetOffset.getQuantity())); + std::make_pair(BaseDecl, VBaseOffsetOffset)); Components.push_back( VTableComponent::MakeVBaseOffset(Offset)); @@ -956,7 +956,7 @@ public: typedef llvm::SmallSetVector PrimaryBasesSetVectorTy; - typedef llvm::DenseMap + typedef llvm::DenseMap VBaseOffsetOffsetsMapTy; typedef llvm::DenseMap @@ -1335,7 +1335,7 @@ ReturnAdjustment VTableBuilder::ComputeReturnAdjustment(BaseOffset Offset) { if (Offset.DerivedClass == MostDerivedClass) { // We can get the offset offset directly from our map. Adjustment.VBaseOffsetOffset = - VBaseOffsetOffsets.lookup(Offset.VirtualBase); + VBaseOffsetOffsets.lookup(Offset.VirtualBase).getQuantity(); } else { Adjustment.VBaseOffsetOffset = VTables.getVirtualBaseOffsetOffset(Offset.DerivedClass, @@ -2177,8 +2177,9 @@ void VTableBuilder::dumpLayout(llvm::raw_ostream& Out) { for (VBaseOffsetOffsetsMapTy::const_iterator I = VBaseOffsetOffsets.begin(), E = VBaseOffsetOffsets.end(); I != E; ++I) { std::string ClassName = I->first->getQualifiedNameAsString(); - int64_t OffsetOffset = I->second; - ClassNamesAndOffsets.insert(std::make_pair(ClassName, OffsetOffset)); + CharUnits OffsetOffset = I->second; + ClassNamesAndOffsets.insert( + std::make_pair(ClassName, OffsetOffset.getQuantity())); } Out << "Virtual base offset offsets for '"; @@ -2450,7 +2451,8 @@ int64_t CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD, // Insert all types. ClassPairTy ClassPair(RD, I->first); - VirtualBaseClassOffsetOffsets.insert(std::make_pair(ClassPair, I->second)); + VirtualBaseClassOffsetOffsets.insert( + std::make_pair(ClassPair, I->second.getQuantity())); } I = VirtualBaseClassOffsetOffsets.find(ClassPair); @@ -2907,7 +2909,8 @@ void CodeGenVTables::ComputeVTableRelatedInformation(const CXXRecordDecl *RD, // Insert all types. ClassPairTy ClassPair(RD, I->first); - VirtualBaseClassOffsetOffsets.insert(std::make_pair(ClassPair, I->second)); + VirtualBaseClassOffsetOffsets.insert( + std::make_pair(ClassPair, I->second.getQuantity())); } }