[PATCH] MS ABI: Fix vftable mangling by using the vbtable name algorithm

Reid Kleckner rnk at google.com
Thu Feb 27 11:45:52 PST 2014


  Thanks!


================
Comment at: include/clang/AST/VTableBuilder.h:371
@@ +370,3 @@
+/// table pointer.  A record may contain as many vptrs as there are base
+/// subobjects.
+struct VPtrInfo {
----------------
Timur Iskhodzhanov wrote:
> Wait, a record can contain up to twice as many, no?
I meant of a given kind.  It seems confusing to mix them.

================
Comment at: include/clang/AST/VTableBuilder.h:392
@@ -430,3 +391,3 @@
 
-  /// The vbptr is stored inside this subobject.
-  const CXXRecordDecl *BaseWithVBPtr;
+  /// The vptr is stored inside this subobject.
+  const CXXRecordDecl *BaseWithVPtr;
----------------
Timur Iskhodzhanov wrote:
> Are there any corner-cases when we have e.g. two bases of the same type?
> After all, there's a `BaseSubobject` type which also holds the offset.
> 
> Can/should we merge `NonVirtualOffset` and `BaseWithVPtr` into one `BaseSubobject`?
> See also `BaseOffset`
This is actually only here to support vbptrs, because they can occur at non-zero offsets.  The full offset of a vptr can be computed as:

vbase-adjustment + nvbase-adjustment + vptr-offset

vptr-offset is always zero for vfptrs.  I could probably simplify this by simply storing the vptr offset directly.

================
Comment at: include/clang/AST/VTableBuilder.h:413
@@ +412,3 @@
+  /// vftables.
+  BasePath PathToBaseWithVPtr;
+
----------------
Timur Iskhodzhanov wrote:
> ...WithVFPtr maybe?
I'd rather keep it generic.


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

BRANCH
  mangle-vftables

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list