]> granicus.if.org Git - clang/commitdiff
Be sure to select primary bases among the nearly empties in preorder,
authorMike Stump <mrs@apple.com>
Fri, 22 Jan 2010 20:27:17 +0000 (20:27 +0000)
committerMike Stump <mrs@apple.com>
Fri, 22 Jan 2010 20:27:17 +0000 (20:27 +0000)
not just among the direct bases.  Before we where missing nearly
empties that were bases of virtual base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94208 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp
test/CodeGenCXX/virt.cpp

index cfd89eaed3507fca15597e3bcc7e1a86fcd1e3da..0aa01801959cdea13608a2c4da7730eea1952ddc 100644 (file)
@@ -119,6 +119,11 @@ ASTRecordLayoutBuilder::SelectPrimaryVBase(const CXXRecordDecl *RD,
         return;
       }
     }
+    if (i->isVirtual()) {
+      SelectPrimaryVBase(Base, FirstPrimary);
+      if (PrimaryBase.getBase())
+        return;
+    }
   }
 }
 
index 2717d6cf94e6b708d9d294bf267f21ab8086f601..c1cf03609c5ae8a12730e1c31d75c8d0dbfd3166 100644 (file)
@@ -1091,6 +1091,45 @@ struct test22_D : test22_s3 { virtual void dtor() { } };
 // CHECK-LP64-NEXT:        .quad   __ZThn8_N8test22_D4dtorEv
 
 
+class test23_s1 {
+  virtual void fun1(char *t) { }
+};
+class test23_s2 {
+  virtual void fun2(char *t) { }
+};
+class test23_s3 {
+  virtual void fun3(char *t) { }
+};
+class test23_s4: virtual test23_s1, test23_s2, test23_s3 {
+  virtual void fun4(char *t) { }
+};
+class test23_D: virtual test23_s4 {
+  virtual void fun5(char *t) { }
+};
+
+
+// CHECK-LP64:     __ZTV8test23_D:
+// CHECK-LP64-NEXT:    .quad   0
+// CHECK-LP64-NEXT:    .quad   8
+// CHECK-LP64-NEXT:    .quad   0
+// CHECK-LP64-NEXT:    .quad   0
+// CHECK-LP64-NEXT:    .quad   __ZTI8test23_D
+// CHECK-LP64-NEXT:    .quad   __ZN9test23_s14fun1EPc
+// CHECK-LP64-NEXT:    .quad   __ZN8test23_D4fun5EPc
+// CHECK-LP64-NEXT     .quad   8
+// CHECK-LP64:         .quad   0
+// CHECK-LP64-NEXT:    .quad   0
+// CHECK-LP64:         .quad   18446744073709551608
+// CHECK-LP64-NEXT:    .quad   18446744073709551608
+// CHECK-LP64-NEXT:    .quad   __ZTI8test23_D
+// CHECK-LP64-NEXT:    .quad   __ZN9test23_s24fun2EPc
+// CHECK-LP64-NEXT:    .quad   __ZN9test23_s44fun4EPc
+// CHECK-LP64-NEXT:    .quad   18446744073709551600
+// CHECK-LP64-NEXT:    .quad   __ZTI8test23_D
+// CHECK-LP64-NEXT:    .quad   __ZN9test23_s34fun3EPc
+
+
+test23_D d23;
 test22_D d22;
 test21_D d21;
 test20_D d20;