[cfe-commits] r94208 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp test/CodeGenCXX/virt.cpp

Mike Stump mrs at apple.com
Fri Jan 22 12:27:17 PST 2010


Author: mrs
Date: Fri Jan 22 14:27:17 2010
New Revision: 94208

URL: http://llvm.org/viewvc/llvm-project?rev=94208&view=rev
Log:
Be sure to select primary bases among the nearly empties in preorder,
not just among the direct bases.  Before we where missing nearly
empties that were bases of virtual base classes.

Modified:
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
    cfe/trunk/test/CodeGenCXX/virt.cpp

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=94208&r1=94207&r2=94208&view=diff

==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Jan 22 14:27:17 2010
@@ -119,6 +119,11 @@
         return;
       }
     }
+    if (i->isVirtual()) {
+      SelectPrimaryVBase(Base, FirstPrimary);
+      if (PrimaryBase.getBase())
+        return;
+    }
   }
 }
 

Modified: cfe/trunk/test/CodeGenCXX/virt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/virt.cpp?rev=94208&r1=94207&r2=94208&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/virt.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/virt.cpp Fri Jan 22 14:27:17 2010
@@ -1091,6 +1091,45 @@
 // 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;





More information about the cfe-commits mailing list