Commit bb5a17e8 authored by Timur Iskhodzhanov's avatar Timur Iskhodzhanov
Browse files

Fix one FIXME in VTableBuilder

llvm-svn: 181396
parent 386ab7f8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ struct BaseOffset {
  const CXXRecordDecl *DerivedClass;
  
  /// VirtualBase - If the path from the derived class to the base class
  /// involves a virtual base class, this holds its declaration.
  /// involves virtual base classes, this holds the declaration of the last
  /// virtual base in this path (i.e. closest to the base class).
  const CXXRecordDecl *VirtualBase;

  /// NonVirtualOffset - The offset from the derived class to the base class.
@@ -219,16 +220,15 @@ static BaseOffset ComputeBaseOffset(ASTContext &Context,
  const CXXRecordDecl *VirtualBase = 0;
  
  // First, look for the virtual base class.
  for (unsigned I = 0, E = Path.size(); I != E; ++I) {
    const CXXBasePathElement &Element = Path[I];
  for (int I = Path.size(), E = 0; I != E; --I) {
    const CXXBasePathElement &Element = Path[I - 1];

    if (Element.Base->isVirtual()) {
      // FIXME: Can we break when we find the first virtual base?
      // (If we can't, can't we just iterate over the path in reverse order?)
      NonVirtualStart = I + 1;
      NonVirtualStart = I;
      QualType VBaseType = Element.Base->getType();
      VirtualBase =
        cast<CXXRecordDecl>(VBaseType->getAs<RecordType>()->getDecl());
      break;
    }
  }