Layout information for a record gets stored in the `ClangASTImporter` associated with the `DWARFASTParserClang` that originally parsed the record. LLDB sometimes moves clang types from one AST to another (in the reproducer the origin AST was a precompiled-header and the destination was the AST backing the executable). When clang then asks LLDB to `layoutRecordType`, it will do so with the help of the `ClangASTImporter` the type is associated with. If the type's origin is actually in a different LLDB module (and thus a different `DWARFASTParserClang` was used to set its layout info), we won't find the layout info in our local `ClangASTImporter`. In the reproducer this meant we would drop the alignment info of the origin type and misread a variable's contents with `frame var` and `expr`. There is logic in `ClangASTSource::layoutRecordType` to import an origin's layout info. This patch re-uses that infrastructure to import an origin's layout from one `ClangASTImporter` instance to another. rdar://123274144
11 lines
247 B
C++
11 lines
247 B
C++
int main(int argc, const char *argv[]) {
|
|
struct MatrixData data = {0};
|
|
data.section.origin.row = 1;
|
|
data.section.origin.col = 2;
|
|
data.section.size.row = 3;
|
|
data.section.size.col = 4;
|
|
data.stride = 5;
|
|
|
|
return data.section.size.row;
|
|
}
|