[all-commits] [llvm/llvm-project] 07ffb7: [lldb][ClangASTImporter] Import record layouts fro...
Michael Buch via All-commits
all-commits at lists.llvm.org
Thu Feb 29 13:40:15 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 07ffb7e294767b74e43f90e9ab3d713da929b907
https://github.com/llvm/llvm-project/commit/07ffb7e294767b74e43f90e9ab3d713da929b907
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2024-02-29 (Thu, 29 Feb 2024)
Changed paths:
M lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
A lldb/test/API/lang/cpp/gmodules/alignment/Makefile
A lldb/test/API/lang/cpp/gmodules/alignment/TestPchAlignment.py
A lldb/test/API/lang/cpp/gmodules/alignment/main.cpp
A lldb/test/API/lang/cpp/gmodules/alignment/pch.h
Log Message:
-----------
[lldb][ClangASTImporter] Import record layouts from origin if available (#83295)
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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list