From: Anders Carlsson Date: Mon, 3 May 2010 00:55:11 +0000 (+0000) Subject: Store the entire base subobject in SubVTTIndices. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3855a07db05677883f4a9534e324da22ed1c6f9a;p=clang Store the entire base subobject in SubVTTIndices. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102890 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVTT.cpp b/lib/CodeGen/CGVTT.cpp index 3118fa2f53..15e564810f 100644 --- a/lib/CodeGen/CGVTT.cpp +++ b/lib/CodeGen/CGVTT.cpp @@ -43,7 +43,7 @@ class VTTBuilder { /// SubVTTIndicies - The sub-VTT indices for the bases of the most derived /// class. - llvm::DenseMap SubVTTIndicies; + llvm::DenseMap SubVTTIndicies; /// SecondaryVirtualPointerIndices - The secondary virtual pointer indices of /// all subobjects of the most derived class. @@ -116,8 +116,7 @@ public: } /// getSubVTTIndicies - Returns a reference to the sub-VTT indices. - const llvm::DenseMap & - getSubVTTIndicies() const { + const llvm::DenseMap &getSubVTTIndicies() const { return SubVTTIndicies; } @@ -341,7 +340,7 @@ void VTTBuilder::LayoutVTT(BaseSubobject Base, bool BaseIsVirtual) { if (!IsPrimaryVTT) { // Remember the sub-VTT index. - SubVTTIndicies[RD] = VTTComponents.size(); + SubVTTIndicies[Base] = VTTComponents.size(); } AddressPointsMapTy AddressPoints; @@ -436,24 +435,24 @@ bool CodeGenVTables::needsVTTParameter(GlobalDecl GD) { uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD, BaseSubobject Base) { - ClassPairTy ClassPair(RD, Base.getBase()); + BaseSubobjectPairTy ClassSubobjectPair(RD, Base); - SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassPair); + SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassSubobjectPair); if (I != SubVTTIndicies.end()) return I->second; VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false); - for (llvm::DenseMap::const_iterator I = + for (llvm::DenseMap::const_iterator I = Builder.getSubVTTIndicies().begin(), E = Builder.getSubVTTIndicies().end(); I != E; ++I) { // Insert all indices. - ClassPairTy ClassPair(RD, I->first); + BaseSubobjectPairTy ClassSubobjectPair(RD, I->first); - SubVTTIndicies.insert(std::make_pair(ClassPair, I->second)); + SubVTTIndicies.insert(std::make_pair(ClassSubobjectPair, I->second)); } - I = SubVTTIndicies.find(ClassPair); + I = SubVTTIndicies.find(ClassSubobjectPair); assert(I != SubVTTIndicies.end() && "Did not find index!"); return I->second; diff --git a/lib/CodeGen/CGVTables.h b/lib/CodeGen/CGVTables.h index 3cfdb181f9..6c18ca83f0 100644 --- a/lib/CodeGen/CGVTables.h +++ b/lib/CodeGen/CGVTables.h @@ -216,8 +216,8 @@ class CodeGenVTables { /// integers are the vtable components. VTableLayoutMapTy VTableLayoutMap; - typedef llvm::DenseMap, uint64_t> AddressPointsMapTy; + typedef std::pair BaseSubobjectPairTy; + typedef llvm::DenseMap AddressPointsMapTy; /// Address points - Address points for all vtables. AddressPointsMapTy AddressPoints; @@ -247,14 +247,12 @@ class CodeGenVTables { return &Components[1]; } - typedef llvm::DenseMap SubVTTIndiciesMapTy; + typedef llvm::DenseMap SubVTTIndiciesMapTy; /// SubVTTIndicies - Contains indices into the various sub-VTTs. SubVTTIndiciesMapTy SubVTTIndicies; - - typedef llvm::DenseMap, uint64_t> + typedef llvm::DenseMap SecondaryVirtualPointerIndicesMapTy; /// SecondaryVirtualPointerIndices - Contains the secondary virtual pointer