r183318 - [ms-cxxabi] Fix vbptr offsets in memptrs when the vbptr is in an nvbase
Reid Kleckner
reid at kleckner.net
Wed Jun 5 08:58:30 PDT 2013
Author: rnk
Date: Wed Jun 5 10:58:29 2013
New Revision: 183318
URL: http://llvm.org/viewvc/llvm-project?rev=183318&view=rev
Log:
[ms-cxxabi] Fix vbptr offsets in memptrs when the vbptr is in an nvbase
Also addresses a review comment from John from on r180985 by removing
the "== -1" check, since it's now reusing the correct code which has the
comment.
Modified:
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=183318&r1=183317&r2=183318&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Wed Jun 5 10:58:29 2013
@@ -661,12 +661,8 @@ MicrosoftCXXABI::EmitFullMemberPointer(l
CGM.IntTy, NonVirtualBaseAdjustment.getQuantity()));
if (hasVBPtrOffsetField(Inheritance)) {
- // FIXME: We actually need to search non-virtual bases for vbptrs.
- int64_t VBPtrOffset =
- getContext().getASTRecordLayout(RD).getVBPtrOffset().getQuantity();
- if (VBPtrOffset == -1)
- VBPtrOffset = 0;
- fields.push_back(llvm::ConstantInt::get(CGM.IntTy, VBPtrOffset));
+ fields.push_back(llvm::ConstantInt::get(
+ CGM.IntTy, GetVBPtrOffsetFromBases(RD).getQuantity()));
}
// The rest of the fields are adjusted by conversions to a more derived class.
Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp?rev=183318&r1=183317&r2=183318&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp Wed Jun 5 10:58:29 2013
@@ -68,7 +68,7 @@ void (Virtual ::*v_f_memptr)();
// CHECK: @"\01?v_f_memptr@@3P8Virtual@@AEXXZA" = global { i8*, i32, i32 } zeroinitializer, align 4
// We can define Unspecified after locking in the inheritance model.
-struct Unspecified : Virtual {
+struct Unspecified : Multiple, Virtual {
void foo();
int u;
};
@@ -86,7 +86,7 @@ void (Unspecified::*u_f_mp)() = &Unspeci
// CHECK: @"\01?v_f_mp at Const@@3P8Virtual@@AEXXZA" =
// CHECK: global { i8*, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo at Virtual@@QAEXXZ" to i8*), i32 0, i32 0 }, align 4
// CHECK: @"\01?u_f_mp at Const@@3P8Unspecified@@AEXXZA" =
-// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo at Unspecified@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 }, align 4
+// CHECK: global { i8*, i32, i32, i32 } { i8* bitcast ({{.*}} @"\01?foo at Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 }, align 4
}
namespace CastParam {
@@ -156,7 +156,7 @@ void EmitNonVirtualMemberPointers() {
// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo at Virtual@@QAEXXZ" to i8*), i32 0, i32 0 },
// CHECK: { i8*, i32, i32 }* %{{.*}}, align 4
// CHECK: store { i8*, i32, i32, i32 }
-// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo at Unspecified@@QAEXXZ" to i8*), i32 0, i32 0, i32 0 },
+// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo at Unspecified@@QAEXXZ" to i8*), i32 0, i32 12, i32 0 },
// CHECK: { i8*, i32, i32, i32 }* %{{.*}}, align 4
// CHECK: store { i8*, i32, i32, i32 }
// CHECK: { i8* bitcast (void (%{{.*}}*)* @"\01?foo at UnspecWithVBPtr@@QAEXXZ" to i8*),
More information about the cfe-commits
mailing list