
Summary: This patch improves support of PDB as an external layout source in the next cases: - Multiple non-virtual inheritance from packed base classes. When using external layout, there's no need to align `NonVirtualSize` of a base class. It may cause an overlapping when the next base classes will be layouted (but there is a slightly different case in the test because I can't find a way to specify a base offset); - Support of nameless structs and unions. There is no info about nameless child structs and unions in Microsoft cl-emitted PDBs. Instead all its fields are just treated as outer structure's (union's) fields. This also causes a fields overlapping, and makes it possible for unions to have fields located at a non-zero offset. Reviewers: rsmith, zturner, rnk, mstorsjo, majnemer Reviewed By: rnk Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D49871 llvm-svn: 338353
27 lines
497 B
C++
27 lines
497 B
C++
// RUN: %clang_cc1 -w -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-layout-packed-base.layout %s | FileCheck %s
|
|
|
|
// CHECK: Type: class B<0>
|
|
// CHECK: FieldOffsets: [0, 32]
|
|
|
|
// CHECK: Type: class B<1>
|
|
// CHECK: FieldOffsets: [0, 32]
|
|
|
|
//#pragma pack(push, 1)
|
|
template<int I>
|
|
class B {
|
|
int _b1;
|
|
char _b2;
|
|
};
|
|
//#pragma pack(pop)
|
|
|
|
// CHECK: Type: class C
|
|
// CHECK: FieldOffsets: [80]
|
|
|
|
class C : B<0>, B<1> {
|
|
char _c;
|
|
};
|
|
|
|
void use_structs() {
|
|
C cs[sizeof(C)];
|
|
}
|