[cfe-commits] PATCH: make the logic more obvious

Zhongxing Xu xuzhongxing at gmail.com
Wed Mar 3 19:09:35 PST 2010


This patch makes logic of selecting primary vbase more obvious:

Index: lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- lib/AST/RecordLayoutBuilder.cpp	(版本 97625)
+++ lib/AST/RecordLayoutBuilder.cpp	(工作副本)
@@ -109,20 +109,19 @@
       SelectPrimaryVBase(Base, FirstPrimary);
       if (PrimaryBase.getBase())
         return;
-      continue;
-    }
-    if (IsNearlyEmpty(Base)) {
-      if (FirstPrimary==0)
-        FirstPrimary = Base;
-      if (!IndirectPrimaryBases.count(Base)) {
-        setPrimaryBase(Base, /*IsVirtual=*/true);
-        return;
+    } else {
+      if (IsNearlyEmpty(Base)) {
+        if (FirstPrimary==0)
+          FirstPrimary = Base;
+        if (!IndirectPrimaryBases.count(Base)) {
+          setPrimaryBase(Base, /*IsVirtual=*/true);
+          return;
+        }
       }
+      SelectPrimaryVBase(Base, FirstPrimary);
+      if (PrimaryBase.getBase())
+        return;
     }
-    assert(i->isVirtual());
-    SelectPrimaryVBase(Base, FirstPrimary);
-    if (PrimaryBase.getBase())
-      return;
   }
 }




More information about the cfe-commits mailing list