Skip to content

lldb: CXXRecordDecl is incorrectly marked as trivial #73563

@hokein

Description

@hokein

Split from the issue #72913.

// CXXRecordDecl emitted by clang is DefinitionData pass_in_registers aggregate standard_layout trivially_copyable literal has_constexpr_non_copy_move_ctor can_const_default_init
// CXXRecordDecl emitted by lldb is DefinitionData pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
struct NonTrivialCtor {
  int a = 0;
};

The synthetic CXXRecordDecl AST node in lldb is incorrectly marked as trivial, this will cause incorrect layout calculation.

Comments from @Michael137

Something I noticed that makes this trickier is that RecordDecl::isTrivial() returns true for bar when using LLDBs AST. Whereas with clang it's actually false (which is correct because bar has a default member initialiser, making the default constructor non-trivial). This is important for mustSkipTailPadding, to determine whether to round up the size to alignment or not. So that's a separate bug that needs fixing first

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions