More ASTRecordLayout changes for MS ABI; based on patch by r4start.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142694 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/ms_class_layout.cpp b/test/Sema/ms_class_layout.cpp
index f516aa5..9a0cd45 100644
--- a/test/Sema/ms_class_layout.cpp
+++ b/test/Sema/ms_class_layout.cpp
@@ -61,6 +61,12 @@
 {
 };
 
+struct I : public virtual D
+{
+  virtual ~I(){}
+  double q;
+};
+
 #pragma pack(pop)
 
 // This needs only for building layouts. 
@@ -72,18 +78,19 @@
   DerivedStruct* v;
   H* g;
   BaseStruct* u;
+  I* i;
   return 0;
 }
 
 // CHECK:       0 | class D
-// CHECK-NEXT:  0 |   (D vtable pointer)
+// CHECK-NEXT:  0 |   (D vftable pointer)
 // CHECK-NEXT:  8 |   double a
 
 // CHECK-NEXT: sizeof=16, dsize=16, align=8
 // CHECK-NEXT: nvsize=16, nvalign=8
 
 // CHECK:       0 | class B
-// CHECK-NEXT:  0 |   (B vtable pointer)
+// CHECK-NEXT:  0 |   (B vftable pointer)
 // CHECK-NEXT:  4 |   int b_field
 
 // CHECK-NEXT: sizeof=8, dsize=8, align=4
@@ -91,7 +98,7 @@
 
 // CHECK:       0 | class A
 // CHECK-NEXT:  0 |   class B (primary base)
-// CHECK-NEXT:  0 |     (B vtable pointer)
+// CHECK-NEXT:  0 |     (B vftable pointer)
 // CHECK-NEXT:  4 |     int b_field
 // CHECK-NEXT:  8 |   int a_field
 // CHECK-NEXT: 12 |   char one
@@ -101,10 +108,10 @@
 
 // CHECK:       0 | class C
 // CHECK-NEXT:  0 |   class D (primary base)
-// CHECK-NEXT:  0 |     (D vtable pointer)
+// CHECK-NEXT:  0 |     (D vftable pointer)
 // CHECK-NEXT:  8 |     double a
 // CHECK-NEXT: 16 |   class B (base)
-// CHECK-NEXT: 16 |     (B vtable pointer)
+// CHECK-NEXT: 16 |     (B vftable pointer)
 // CHECK-NEXT: 20 |     int b_field
 // CHECK-NEXT: 24 |   (C vbtable pointer)
 // CHECK-NEXT: 32 |   double c1_field
@@ -113,23 +120,23 @@
 // CHECK-NEXT: 56 |   int c4_field
 // CHECK-NEXT: 64 |   class A (virtual base)
 // CHECK-NEXT: 64 |     class B (primary base)
-// CHECK-NEXT: 64 |       (B vtable pointer)
+// CHECK-NEXT: 64 |       (B vftable pointer)
 // CHECK-NEXT: 68 |       int b_field
 // CHECK-NEXT: 72 |     int a_field
 // CHECK-NEXT: 76 |     char one
 
 // CHECK-NEXT: sizeof=80, dsize=80, align=8
-// CHECK-NEXT: nvsize=80, nvalign=8
+// CHECK-NEXT: nvsize=64, nvalign=8
  
 // CHECK:       0 | struct BaseStruct
 // CHECK-NEXT:  0 |   double v0
 // CHECK-NEXT:  8 |   float v1
 // CHECK-NEXT: 16 |   class C fg
 // CHECK-NEXT: 16 |     class D (primary base)
-// CHECK-NEXT: 16 |       (D vtable pointer)
+// CHECK-NEXT: 16 |       (D vftable pointer)
 // CHECK-NEXT: 24 |       double a
 // CHECK-NEXT: 32 |     class B (base)
-// CHECK-NEXT: 32 |       (B vtable pointer)
+// CHECK-NEXT: 32 |       (B vftable pointer)
 // CHECK-NEXT: 36 |       int b_field
 // CHECK-NEXT: 40 |     (C vbtable pointer)
 // CHECK-NEXT: 48 |     double c1_field
@@ -138,13 +145,13 @@
 // CHECK-NEXT: 72 |     int c4_field
 // CHECK-NEXT: 80 |     class A (virtual base)
 // CHECK-NEXT: 80 |       class B (primary base)
-// CHECK-NEXT: 80 |         (B vtable pointer)
+// CHECK-NEXT: 80 |         (B vftable pointer)
 // CHECK-NEXT: 84 |         int b_field
 // CHECK-NEXT: 88 |       int a_field
 // CHECK-NEXT: 92 |       char one
 
 // CHECK-NEXT: sizeof=80, dsize=80, align=8
-// CHECK-NEXT: nvsize=80, nvalign=8
+// CHECK-NEXT: nvsize=64, nvalign=8
 
 // CHECK: sizeof=96, dsize=96, align=8
 // CHECK-NEXT: nvsize=96, nvalign=8
@@ -155,10 +162,10 @@
 // CHECK-NEXT:  8 |     float v1
 // CHECK-NEXT: 16 |     class C fg
 // CHECK-NEXT: 16 |       class D (primary base)
-// CHECK-NEXT: 16 |         (D vtable pointer)
+// CHECK-NEXT: 16 |         (D vftable pointer)
 // CHECK-NEXT: 24 |         double a
 // CHECK-NEXT: 32 |       class B (base)
-// CHECK-NEXT: 32 |         (B vtable pointer)
+// CHECK-NEXT: 32 |         (B vftable pointer)
 // CHECK-NEXT: 36 |         int b_field
 // CHECK-NEXT: 40 |       (C vbtable pointer)
 // CHECK-NEXT: 48 |       double c1_field
@@ -167,12 +174,12 @@
 // CHECK-NEXT: 72 |       int c4_field
 // CHECK-NEXT: 80 |       class A (virtual base)
 // CHECK-NEXT: 80 |         class B (primary base)
-// CHECK-NEXT: 80 |           (B vtable pointer)
+// CHECK-NEXT: 80 |           (B vftable pointer)
 // CHECK-NEXT: 84 |           int b_field
 // CHECK-NEXT: 88 |         int a_field
 // CHECK-NEXT: 92 |         char one
 // CHECK-NEXT: sizeof=80, dsize=80, align=8
-// CHECK-NEXT: nvsize=80, nvalign=8
+// CHECK-NEXT: nvsize=64, nvalign=8
 
 // CHECK: 96 |   int x
 // CHECK-NEXT: sizeof=104, dsize=104, align=8
@@ -183,14 +190,22 @@
 // CHECK-NEXT: sizeof=4, dsize=4, align=4
 // CHECK-NEXT: nvsize=4, nvalign=4
 
-// FIXME: Dump should not be showing vfptr, and vbptr is in the wrong order.
 // CHECK:       0 | struct H
-// CHECK-NEXT:  0 |   (H vtable pointer)
-// CHECK-NEXT:  4 |   (H vbtable pointer)
 // CHECK-NEXT:  0 |   struct G (base)
 // CHECK-NEXT:  0 |     int g_field
+// CHECK-NEXT:  4 |   (H vbtable pointer)
 // CHECK-NEXT:  8 |   class D (virtual base)
-// CHECK-NEXT:  8 |     (D vtable pointer)
+// CHECK-NEXT:  8 |     (D vftable pointer)
 // CHECK-NEXT: 16 |     double a
 // CHECK-NEXT: sizeof=24, dsize=24, align=8
+// CHECK-NEXT: nvsize=8, nvalign=4
+
+// CHECK:       0 | struct I
+// CHECK-NEXT:  0 |   (I vftable pointer)
+// CHECK-NEXT:  8 |   (I vbtable pointer)
+// CHECK-NEXT: 16 |   double q
+// CHECK-NEXT: 24 |   class D (virtual base)
+// CHECK-NEXT: 24 |     (D vftable pointer)
+// CHECK-NEXT: 32 |     double a
+// CHECK-NEXT: sizeof=40, dsize=40, align=8
 // CHECK-NEXT: nvsize=24, nvalign=8