]> granicus.if.org Git - clang/commitdiff
More cleanup.
authorAnders Carlsson <andersca@mac.com>
Thu, 11 Mar 2010 03:39:12 +0000 (03:39 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 11 Mar 2010 03:39:12 +0000 (03:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98230 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp

index eab4f1113708e417b2b80e131e67bb1929729468..d9fa11d5a8955bf5da08b563e14a507de6214f1c 100644 (file)
@@ -63,32 +63,29 @@ void ASTRecordLayoutBuilder::IdentifyPrimaryBases(const CXXRecordDecl *RD) {
 
 void
 ASTRecordLayoutBuilder::SelectPrimaryVBase(const CXXRecordDecl *RD) {
-
-  for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
-         e = RD->bases_end(); i != e; ++i) {
-    assert(!i->getType()->isDependentType() &&
+  for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
+       E = RD->bases_end(); I != E; ++I) {
+    assert(!I->getType()->isDependentType() &&
            "Cannot layout class with dependent bases.");
+    
     const CXXRecordDecl *Base =
-      cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
-    if (!i->isVirtual()) {
-      SelectPrimaryVBase(Base);
-      if (PrimaryBase.getBase())
-        return;
-      continue;
-    }
-    if (IsNearlyEmpty(Base)) {
-      // Is this the first nearly empty primary virtual base?
-      if (!FirstNearlyEmptyVBase)
-        FirstNearlyEmptyVBase = Base;
+      cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
 
+    // Check if this is a nearly empty virtual base.
+    if (I->isVirtual() && IsNearlyEmpty(Base)) {
+      // If it's not an indirect primary base, then we've found our primary
+      // base.
       if (!IndirectPrimaryBases.count(Base)) {
         PrimaryBase = ASTRecordLayout::PrimaryBaseInfo(Base,
                                                        /*IsVirtual=*/true);
         return;
       }
+      
+      // Is this the first nearly empty virtual base?
+      if (!FirstNearlyEmptyVBase)
+        FirstNearlyEmptyVBase = Base;
     }
     
-    assert(i->isVirtual());
     SelectPrimaryVBase(Base);
     if (PrimaryBase.getBase())
       return;
@@ -142,8 +139,8 @@ void ASTRecordLayoutBuilder::DeterminePrimaryBase(const CXXRecordDecl *RD) {
   // Otherwise, it is the first nearly empty virtual base that is not an
   // indirect primary virtual base class, if one exists.
   if (FirstNearlyEmptyVBase) {
-    PrimaryBase = 
-      ASTRecordLayout::PrimaryBaseInfo(FirstNearlyEmptyVBase, /*IsVirtual=*/true);
+    PrimaryBase = ASTRecordLayout::PrimaryBaseInfo(FirstNearlyEmptyVBase, 
+                                                   /*IsVirtual=*/true);
     return;
   }