Here is a patch that does just that.<br><br><div class="gmail_quote">On Wed, Sep 23, 2009 at 3:38 PM, Devang Patel <span dir="ltr"><<a href="mailto:devang.patel@gmail.com" target="_blank">devang.patel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div>On Wed, Sep 23, 2009 at 2:27 PM, Talin <<a href="mailto:viridia@gmail.com" target="_blank">viridia@gmail.com</a>> wrote:<br>
> On Wed, Sep 23, 2009 at 1:51 PM, Dan Gohman <<a href="mailto:gohman@apple.com" target="_blank">gohman@apple.com</a>> wrote:<br>
>><br>
>> On Sep 22, 2009, at 4:49 PM, Talin wrote:<br>
>>><br>
>>> // Calculate the size of the specified LLVM type.<br>
>>> Constant * DebugInfoBuilder::getSize(const Type * type) {<br>
>>>    Constant * one = ConstantInt::get(Type::Int32Ty, 1);<br>
>>>    return ConstantExpr::getPtrToInt(<br>
>>>        ConstantExpr::getGetElementPtr(<br>
>>>            ConstantPointerNull::get(PointerType::getUnqual(type)),<br>
>>>            &one, 1), Type::Int32Ty);<br>
>>> }<br>
>>><br>
>>> Constant * DebugInfoBuilder::getAlignment(const Type * type) {<br>
>>>    // Calculates the alignment of T using "sizeof({i8, T}) - sizeof(T)"<br>
>>>    return ConstantExpr::getSub(<br>
>>>        getSize(StructType::get(Type::Int8Ty, type, NULL)),<br>
>>>        getSize(type));<br>
>>> }<br>
>><br>
>> Are ConstantExpr::getAlignOf, getSizeOf, and getOffsetOf what<br>
>> you're looking for?<br>
>><br>
> That will work. Now all I need is for the methods of DIFactory to take a<br>
> Constant* instead of uint64.<br>
<br>
</div></div>ok. Feel free to add<br>
    /// CreateBasicType - Create a basic type like int, float, etc.<br>
    DIBasicType CreateBasicType(DIDescriptor Context, const std::string &Name,<br>
                                DICompileUnit CompileUnit, unsigned LineNumber,<br>
                                uint64_t SizeInBits, uint64_t AlignInBits,<br>
                                uint64_t OffsetInBits, unsigned Flags,<br>
                                unsigned Encoding);<br>
<br>
variants that take Constant*, for example,<br>
<br>
    /// CreateBasicType - Create a basic type like int, float, etc.<br>
    DIBasicType CreateBasicType(DIDescriptor Context, const std::string &Name,<br>
                                DICompileUnit CompileUnit, unsigned LineNumber,<br>
                                Constant *SizeInBits, Constant *AlignInBits,<br>
                                Constant *OffsetInBits, unsigned Flags,<br>
                                unsigned Encoding);<br>
<br>
and so on.<br>
-<br>
<font color="#888888">Devang<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>