[LLVMdev] DIFactory interface is going away

Devang Patel dpatel at apple.com
Fri Feb 25 08:46:45 PST 2011


On Feb 25, 2011, at 2:28 AM, Duncan Sands wrote:

> It does make me wonder how you are supposed to represent types which cannot
> be properly represented by LLVM types, for example structs with fields at
> variable offsets from the start and/or of variable size; or structs with
> fields that may or may not be present depending on the value of other fields.
> Such types occur in Ada for example.

The metadata constructs used to encode debugging information do not use (or refer) LLVM types directly.  Here is the interface to emit debug info for a member.

    /// createMemberType - Create debugging information entry for a member.                      
    /// @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.                                                         
    DIType createMemberType(StringRef Name, DIFile File,
                            unsigned LineNo, uint64_t SizeInBits,
                            uint64_t AlignInBits, uint64_t OffsetInBits,
                            unsigned Flags, DIType Ty);


Of course,  the FE needs to know the offset, size, alignment etc... for each field as per source language. The Parent type here is also debug info entry for the enclosing structure/class. Regarding variable size fields, I am not sure how they are encoded in DWARF.

-
Devang



More information about the llvm-dev mailing list