Duncan Sands
2013-Apr-09 08:53 UTC
[LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
Hi David, I'm seeing an assertion failure when passing this node !{i32 786454, metadata <badref>, metadata <badref>, metadata !"fn_t", i32 5, i64 0, i64 0, i64 0, i32 0, metadata <badref>} ; [ DW_TAG_typedef ] [fn_t] [line 5, size 0, align 0, offset 0] [from ] as the function type parameter to DIBuilder::createFunction, due to this check in DebugInfo.cpp: 486 DICompositeType Ty = getType(); 487 if (!Ty.Verify()) 488 return false; Is it in fact wrong to pass a typedef here? Thanks, Duncan.
Eric Christopher
2013-Apr-09 22:20 UTC
[LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
On Tue, Apr 9, 2013 at 1:53 AM, Duncan Sands <baldrick at free.fr> wrote:> Hi David, I'm seeing an assertion failure when passing this node > > !{i32 786454, metadata <badref>, metadata <badref>, metadata !"fn_t", i32 > 5, i64 0, i64 0, i64 0, i32 0, metadata <badref>} ; [ DW_TAG_typedef ] > [fn_t] [line 5, size 0, align 0, offset 0] [from ] > > as the function type parameter to DIBuilder::createFunction, due to this > check > in DebugInfo.cpp: > > 486 DICompositeType Ty = getType(); > 487 if (!Ty.Verify()) > 488 return false; > > Is it in fact wrong to pass a typedef here? >I can't come up with a way that'd be correct, no. You should be using createSubroutineType and passing that into the builder. Have example code where this is coming up? -eric
Duncan Sands
2013-Apr-10 08:14 UTC
[LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
Hi Eric, On 10/04/13 00:20, Eric Christopher wrote:> On Tue, Apr 9, 2013 at 1:53 AM, Duncan Sands <baldrick at free.fr> wrote: >> Hi David, I'm seeing an assertion failure when passing this node >> >> !{i32 786454, metadata <badref>, metadata <badref>, metadata !"fn_t", i32 >> 5, i64 0, i64 0, i64 0, i32 0, metadata <badref>} ; [ DW_TAG_typedef ] >> [fn_t] [line 5, size 0, align 0, offset 0] [from ] >> >> as the function type parameter to DIBuilder::createFunction, due to this >> check >> in DebugInfo.cpp: >> >> 486 DICompositeType Ty = getType(); >> 487 if (!Ty.Verify()) >> 488 return false; >> >> Is it in fact wrong to pass a typedef here? >> > > I can't come up with a way that'd be correct, no. You should be using > createSubroutineType and passing that into the builder. Have example > code where this is coming up?I guess my question is: what is a DW_TAG_typedef node? Is it a type node, in which the type is defined to be the same as another type (a bit like an alias in LLVM IR)? Or is it a node which says "type A is the same as type B", but the DW_TAG_typedef node is not itself the type A? Thanks, Duncan.
Duncan Sands
2013-Apr-10 11:48 UTC
[LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
Hi Eric, On 10/04/13 00:20, Eric Christopher wrote:> On Tue, Apr 9, 2013 at 1:53 AM, Duncan Sands <baldrick at free.fr> wrote: >> Hi David, I'm seeing an assertion failure when passing this node >> >> !{i32 786454, metadata <badref>, metadata <badref>, metadata !"fn_t", i32 >> 5, i64 0, i64 0, i64 0, i32 0, metadata <badref>} ; [ DW_TAG_typedef ] >> [fn_t] [line 5, size 0, align 0, offset 0] [from ] >> >> as the function type parameter to DIBuilder::createFunction, due to this >> check >> in DebugInfo.cpp: >> >> 486 DICompositeType Ty = getType(); >> 487 if (!Ty.Verify()) >> 488 return false; >> >> Is it in fact wrong to pass a typedef here? >> > > I can't come up with a way that'd be correct, no. You should be using > createSubroutineType and passing that into the builder. Have example > code where this is coming up?OK, it looks like a DW_TAG_typedef node defines a new type. If the original type is a subroutine type, I don't see why a typedef of it shouldn't be used anywhere the original could. After all, it is just an alternative name for the same thing. You clearly have a different mental model of what a typedef is, but what is it? Ciao, Duncan.
Maybe Matching Threads
- [LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
- [LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
- [LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
- [LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction
- [LLVMdev] Passing DW_TAG_typedef as the type to DIBuilder's createFunction