Skip to content

Non constant size and offset in DWARF #141106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
auto *ISATy = DBuilder.createPointerType(ClassTy, Size);

ObjTy = DBuilder.createStructType(TheCU, "objc_object", TheCU->getFile(), 0,
0, 0, llvm::DINode::FlagZero, nullptr,
llvm::DINodeArray());
(uint64_t)0, 0, llvm::DINode::FlagZero,
nullptr, llvm::DINodeArray());

DBuilder.replaceArrays(
ObjTy, DBuilder.getOrCreateArray(&*DBuilder.createMemberType(
Expand Down
56 changes: 56 additions & 0 deletions llvm/include/llvm/IR/DIBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,22 @@ namespace llvm {
uint32_t VBPtrOffset,
DINode::DIFlags Flags);

/// Create debugging information entry for a member.
/// \param Scope Member scope.
/// \param Name Member name.
/// \param File File where this member is defined.
/// \param LineNo Line number.
/// \param SizeInBits Member size.
/// \param AlignInBits Member alignment.
/// \param OffsetInBits Member offset.
/// \param Flags Flags to encode member attribute, e.g. private
/// \param Ty Parent type.
/// \param Annotations Member annotations.
LLVM_ABI DIDerivedType *createMemberType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
Metadata *SizeInBits, uint32_t AlignInBits, Metadata *OffsetInBits,
DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations = nullptr);

/// Create debugging information entry for a member.
/// \param Scope Member scope.
/// \param Name Member name.
Expand Down Expand Up @@ -423,6 +439,23 @@ namespace llvm {
Constant *Discriminant,
DIType *Ty);

/// Create debugging information entry for a bit field member.
/// \param Scope Member scope.
/// \param Name Member name.
/// \param File File where this member is defined.
/// \param LineNo Line number.
/// \param SizeInBits Member size.
/// \param OffsetInBits Member offset.
/// \param StorageOffsetInBits Member storage offset.
/// \param Flags Flags to encode member attribute.
/// \param Ty Parent type.
/// \param Annotations Member annotations.
LLVM_ABI DIDerivedType *createBitFieldMemberType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
Metadata *SizeInBits, Metadata *OffsetInBits,
uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty,
DINodeArray Annotations = nullptr);

/// Create debugging information entry for a bit field member.
/// \param Scope Member scope.
/// \param Name Member name.
Expand Down Expand Up @@ -514,6 +547,29 @@ namespace llvm {
unsigned RunTimeLang = 0, DIType *VTableHolder = nullptr,
MDNode *TemplateParms = nullptr, StringRef UniqueIdentifier = "");

/// Create debugging information entry for a struct.
/// \param Scope Scope in which this struct is defined.
/// \param Name Struct name.
/// \param File File where this member is defined.
/// \param LineNumber Line number.
/// \param SizeInBits Member size.
/// \param AlignInBits Member alignment.
/// \param Flags Flags to encode member attribute, e.g. private
/// \param Elements Struct elements.
/// \param RunTimeLang Optional parameter, Objective-C runtime version.
/// \param UniqueIdentifier A unique identifier for the struct.
/// \param Specification The type that this type completes. This is used by
/// Swift to represent generic types.
/// \param NumExtraInhabitants The number of extra inhabitants of the type.
/// An extra inhabitant is a bit pattern that does not represent a valid
/// value for instances of a given type. This is used by the Swift language.
LLVM_ABI DICompositeType *createStructType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
Metadata *SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "",
DIType *Specification = nullptr, uint32_t NumExtraInhabitants = 0);

/// Create debugging information entry for a struct.
/// \param Scope Scope in which this struct is defined.
/// \param Name Struct name.
Expand Down
Loading