void mangleDeclaration(const NamedDecl *ND);
void mangleFunctionEncoding(const FunctionDecl *FD);
void mangleVariableEncoding(const VarDecl *VD);
- void mangleMemberDataPointer(const CXXRecordDecl *RD, const FieldDecl *FD);
+ void mangleMemberDataPointer(const CXXRecordDecl *RD, const ValueDecl *VD);
void mangleMemberFunctionPointer(const CXXRecordDecl *RD,
const CXXMethodDecl *MD);
void mangleVirtualMemPtrThunk(
}
void MicrosoftCXXNameMangler::mangleMemberDataPointer(const CXXRecordDecl *RD,
- const FieldDecl *FD) {
+ const ValueDecl *VD) {
// <member-data-pointer> ::= <integer-literal>
// ::= $F <number> <number>
// ::= $G <number> <number> <number>
int64_t FieldOffset;
int64_t VBTableOffset;
MSInheritanceAttr::Spelling IM = RD->getMSInheritanceModel();
- if (FD) {
- FieldOffset = getASTContext().getFieldOffset(FD);
+ if (VD) {
+ FieldOffset = getASTContext().getFieldOffset(VD);
assert(FieldOffset % getASTContext().getCharWidth() == 0 &&
"cannot take address of bitfield");
FieldOffset /= getASTContext().getCharWidth();
}
case TemplateArgument::Declaration: {
const NamedDecl *ND = cast<NamedDecl>(TA.getAsDecl());
- if (const FieldDecl *FD = dyn_cast<FieldDecl>(ND)) {
- mangleMemberDataPointer(cast<CXXRecordDecl>(FD->getParent()), FD);
+ if (isa<FieldDecl>(ND) || isa<IndirectFieldDecl>(ND)) {
+ mangleMemberDataPointer(cast<CXXRecordDecl>(ND->getDeclContext()),
+ cast<ValueDecl>(ND));
} else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD);
if (MD && MD->isInstance())
struct M : A, B { int a, b; void f(); virtual void g(); };
struct V : virtual A { int a, b; void f(); virtual void g(); };
struct U { int a, b; void f(); virtual void g(); };
+struct I { union { struct { int a, b; }; }; void f(); virtual void g(); };
struct C { virtual void f(); };
struct D { virtual void g(); };
M m;
V v;
U u;
+ ReadField<I, &S::a>(s);
ReadField<S, &S::a>(s);
ReadField<M, &M::a>(m);
ReadField<V, &V::a>(v);
ReadField<U, &U::a>(u);
+ ReadField<I, &S::b>(s);
ReadField<S, &S::b>(s);
ReadField<M, &M::b>(m);
ReadField<V, &V::b>(v);
}
// CHECK-LABEL: define {{.*}}ReadFields
+// CHECK: call {{.*}} @"\01??$ReadField@UI@@$03@@YAHAAUS@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@US@@$03@@YAHAAUS@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@UM@@$0M@@@YAHAAUM@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@UV@@$F7A@@@YAHAAUV@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@UU@@$G3A@A@@@YAHAAUU@@@Z"
+// CHECK: call {{.*}} @"\01??$ReadField@UI@@$07@@YAHAAUS@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@US@@$07@@YAHAAUS@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@UM@@$0BA@@@YAHAAUM@@@Z"
// CHECK: call {{.*}} @"\01??$ReadField@UV@@$FM@A@@@YAHAAUV@@@Z"