[PATCH] MS ABI: Improve selection of an inheritance model

Richard Smith richard at metafoo.co.uk
Wed Jan 15 14:10:12 PST 2014



================
Comment at: include/clang/Basic/Attr.td:1355-1356
@@ -1354,3 +1354,4 @@
                    Accessor<"IsUnspecified", [Keyword<"">]>];
   // This index is based off the Spellings list and corresponds to the empty
   // keyword "spelling."
+  let AdditionalMembers = [{
----------------
This comment is out of date.

================
Comment at: lib/Sema/SemaType.cpp:5068
@@ -5096,1 +5067,3 @@
 
+    // We lock-in the inheritance model once somebody has asked us to ensure
+    // that a pointer-to-member type is complete.
----------------
"lock in"; "lock-in" is a noun =)

================
Comment at: lib/Sema/SemaType.cpp:5077
@@ +5076,3 @@
+              ->getAsCXXRecordDecl()
+              ->getMostRecentDecl()
+              ->setMSInheritanceModel();
----------------
Reid Kleckner wrote:
> I'm curious, why is it necessary to get the most recent decl?
Consider:

  struct A;
  typedef int A::*p;
  struct __single_inheritance A;
  p my_ptr;

We want to look at the inheritance model of the latest declaration when requiring the type `p` to be complete.

We should probably have a testcase covering this.

================
Comment at: test/SemaCXX/microsoft-abi-ptm.cpp:11
@@ +10,2 @@
+static_assert(sizeof(int B::*) == sizeof(int) * 3, "pointer-to-member should be sizeof(int)*4");
+struct B { };
----------------
Maybe test that `sizeof(int B::*)` is still 12 after this line?


http://llvm-reviews.chandlerc.com/D2548



More information about the cfe-commits mailing list