The no_unique_address attribute is currently a part of C++20 standard and is being used in both libstdc++ and libc++. This causes problems when debugging C++ code with lldb because the latter doesn't expect two non-empty base classes having the same offset and crashes with assertion. Patch attempts to infer this attribute by detecting two consecutive base classes with the same offset to derived class and marking first of those classes as empty and adding no_unique_address attribute to all of its fields.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
From a first glance looks ok but ideally the clang changes would be separate reviews. E.g.,
- Adding markEmpty()
- ASTImporter change with unit-test
- LLDB changes
Changes look fine to me. I would like someone that specializes in the expression parser to give the final ok though.
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp | ||
---|---|---|
551 | revert whitespace only changes |
clang/lib/AST/ASTImporter.cpp | ||
---|---|---|
3896 | The import of attributes is handled in function ASTImporter::Import(Decl*). This new line will probably copy all attributes, that may not work in all cases dependent on the attribute types. This may interfere with the later import of attributes, probably these will be duplicated. What was the need for this line? (Simple attributes that do not have references to other nodes could be copied at this place.) |
clang/lib/AST/ASTImporter.cpp | ||
---|---|---|
3896 | Unfortunately it is too late to copy attribute in ASTImporter::Import(Decl*), because field has already been added to record in a call to ImportImpl (VisitFieldDecl/addDeclInternal). I've reused the current way of cloning attributes in VisitFieldDecl. |