diff options
author | Reid Kleckner <rnk@google.com> | 2016-07-20 14:40:25 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-07-20 14:40:25 +0000 |
commit | 8ad06d6546a3a28673a0a0dc4d1569801fd2c930 (patch) | |
tree | 946ce26e67f97b49c379a65151137d44e8906e5c /clang/lib/AST/VTableBuilder.cpp | |
parent | 4b1d9f7f1887a3ff21a9c17fa53927ea69d96697 (diff) | |
download | bcm5719-llvm-8ad06d6546a3a28673a0a0dc4d1569801fd2c930.tar.gz bcm5719-llvm-8ad06d6546a3a28673a0a0dc4d1569801fd2c930.zip |
[MS] Improve VPtrInfo field names and doc comments
'ReusingBase' was a terrible name. It might actually refer to the most
derived class, which is not a base. 'BaseWithVPtr' was also bad, since
again, it could refer to the most derived class. It was actually the
first base to introduce the vptr, so now it is 'IntroducingObject'.
llvm-svn: 276120
Diffstat (limited to 'clang/lib/AST/VTableBuilder.cpp')
-rw-r--r-- | clang/lib/AST/VTableBuilder.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 640fbf47aea..5c5fefd58e5 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -2931,8 +2931,8 @@ void VFTableBuilder::AddMethods(BaseSubobject Base, unsigned BaseDepth, // class. const CXXRecordDecl *NextBase = nullptr, *NextLastVBase = LastVBase; CharUnits NextBaseOffset; - if (BaseDepth < WhichVFPtr.PathToBaseWithVPtr.size()) { - NextBase = WhichVFPtr.PathToBaseWithVPtr[BaseDepth]; + if (BaseDepth < WhichVFPtr.PathToIntroducingObject.size()) { + NextBase = WhichVFPtr.PathToIntroducingObject[BaseDepth]; if (isDirectVBase(NextBase, RD)) { NextLastVBase = NextBase; NextBaseOffset = MostDerivedClassLayout.getVBaseClassOffset(NextBase); @@ -3124,7 +3124,7 @@ static void dumpMicrosoftThunkAdjustment(const ThunkInfo &TI, raw_ostream &Out, void VFTableBuilder::dumpLayout(raw_ostream &Out) { Out << "VFTable for "; - PrintBasePath(WhichVFPtr.PathToBaseWithVPtr, Out); + PrintBasePath(WhichVFPtr.PathToIntroducingObject, Out); Out << "'"; MostDerivedClass->printQualifiedName(Out); Out << "' (" << Components.size() @@ -3311,10 +3311,10 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables, // Keep track of which vtable the derived class is going to extend with // new methods or bases. We append to either the vftable of our primary // base, or the first non-virtual base that has a vbtable. - if (P->ReusingBase == Base && + if (P->ObjectWithVPtr == Base && Base == (ForVBTables ? Layout.getBaseSharingVBPtr() : Layout.getPrimaryBase())) - P->ReusingBase = RD; + P->ObjectWithVPtr = RD; // Keep track of the full adjustment from the MDC to this vtable. The // adjustment is captured by an optional vbase and a non-virtual offset. @@ -3401,14 +3401,14 @@ typedef llvm::SetVector<BaseSubobject, std::vector<BaseSubobject>, } // This recursive function finds all paths from a subobject centered at -// (RD, Offset) to the subobject located at BaseWithVPtr. +// (RD, Offset) to the subobject located at IntroducingObject. static void findPathsToSubobject(ASTContext &Context, const ASTRecordLayout &MostDerivedLayout, const CXXRecordDecl *RD, CharUnits Offset, - BaseSubobject BaseWithVPtr, + BaseSubobject IntroducingObject, FullPathTy &FullPath, std::list<FullPathTy> &Paths) { - if (BaseSubobject(RD, Offset) == BaseWithVPtr) { + if (BaseSubobject(RD, Offset) == IntroducingObject) { Paths.push_back(FullPath); return; } @@ -3422,7 +3422,7 @@ static void findPathsToSubobject(ASTContext &Context, : Offset + Layout.getBaseClassOffset(Base); FullPath.insert(BaseSubobject(Base, NewOffset)); findPathsToSubobject(Context, MostDerivedLayout, Base, NewOffset, - BaseWithVPtr, FullPath, Paths); + IntroducingObject, FullPath, Paths); FullPath.pop_back(); } } @@ -3497,7 +3497,7 @@ static const FullPathTy *selectBestPath(ASTContext &Context, CharUnits BaseOffset = getOffsetOfFullPath(Context, TopLevelRD, SpecificPath); FinalOverriders Overriders(TopLevelRD, CharUnits::Zero(), TopLevelRD); - for (const CXXMethodDecl *MD : Info->BaseWithVPtr->methods()) { + for (const CXXMethodDecl *MD : Info->IntroducingObject->methods()) { if (!MD->isVirtual()) continue; FinalOverriders::OverriderInfo OI = @@ -3555,15 +3555,15 @@ static void computeFullPathsForVFTables(ASTContext &Context, for (VPtrInfo *Info : Paths) { findPathsToSubobject( Context, MostDerivedLayout, RD, CharUnits::Zero(), - BaseSubobject(Info->BaseWithVPtr, Info->FullOffsetInMDC), FullPath, + BaseSubobject(Info->IntroducingObject, Info->FullOffsetInMDC), FullPath, FullPaths); FullPath.clear(); removeRedundantPaths(FullPaths); - Info->PathToBaseWithVPtr.clear(); + Info->PathToIntroducingObject.clear(); if (const FullPathTy *BestPath = selectBestPath(Context, RD, Info, FullPaths)) for (const BaseSubobject &BSO : *BestPath) - Info->PathToBaseWithVPtr.push_back(BSO.getBase()); + Info->PathToIntroducingObject.push_back(BSO.getBase()); FullPaths.clear(); } } |