jacob-carlborg / dstep

A tool for converting C and Objective-C headers to D modules
204 stars 37 forks source link

Unhandled type kind objCTypeParam #274

Open JackStouffer opened 2 years ago

JackStouffer commented 2 years ago

I'm stress testing DStep with the Foundation headers. I was impressed that NSObject.h worked, but I tried NSArray.h and I got an assert error.

$ ./bin/dstep --version
1.0.2-3-gbc5cda9

$ ./bin/dstep /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSArray.h -o NSArray.d -ObjC
dstep: an unknown error occurred: core.exception.AssertError@dstep/translator/Type.d(623): Unhandled type kind objCTypeParam
----------------
??:? _d_assert_msg [0x10f9ce734]
??:? immutable(char)[] dstep.translator.Type.translateType(dstep.translator.Context.Context, clang.c.Index.CXTypeKind, bool) [0x10f9a3cae]
??:? dstep.translator.Output.SourceNode dstep.translator.Type.translateType(dstep.translator.Context.Context, clang.Cursor.Cursor, clang.Type.Type, bool, bool) [0x10f99edc2]
??:? dstep.translator.Output.SourceNode dstep.translator.Translator.translateFunction(dstep.translator.Context.Context, clang.Cursor.FunctionCursor, immutable(char)[], bool) [0x10f99bc9b]
??:? void dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translateMethod(clang.Cursor.FunctionCursor, bool, immutable(char)[]) [0x10f9b2014]
??:? int dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translate(dstep.translator.Output.Output).__lambda3().__foreachbody1(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) [0x10f9b078b]
??:? int function(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) clang.Visitor.DeclarationVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)).__foreachbody2 [0x10f906b51]
??:? extern (C) clang.c.Index.CXChildVisitResult clang.Visitor.Visitor.visitorFunction(clang.c.Index.CXCursor, clang.c.Index.CXCursor, void*) [0x10f90620e]
??:? _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb [0x10ffb043d]
??:? _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE [0x10ffb1b28]
??:? _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE [0x10ffb1bb0]
??:? _ZN5clang8cxcursor13CursorVisitor22VisitObjCInterfaceDeclEPNS_17ObjCInterfaceDeclE [0x10ffb3b9e]
??:? _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor [0x10ffb0ac9]
??:? clang_visitChildren [0x10ffb9a4f]
??:? int clang.Visitor.DeclarationVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)) [0x10f906aca]
??:? void dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translate(dstep.translator.Output.Output).__lambda3() [0x10f9b06f4]
??:? void dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translate(dstep.translator.Output.Output) [0x10f9b067e]
??:? void dstep.translator.Translator.Translator.translateObjCInterfaceDecl(dstep.translator.Output.Output, clang.Cursor.Cursor, clang.Cursor.Cursor) [0x10f99798d]
??:? void dstep.translator.Translator.Translator.translate(dstep.translator.Output.Output, clang.Cursor.Cursor, clang.Cursor.Cursor) [0x10f997287]
??:? void dstep.translator.Translator.Translator.translateInGlobalScope(dstep.translator.Output.Output, clang.Cursor.Cursor, clang.Cursor.Cursor) [0x10f997054]
??:? int dstep.translator.Translator.Translator.translateCursors().__foreachbody3(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) [0x10f996f07]
??:? int function(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) clang.Visitor.InOrderVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)).__foreachbody11 [0x10f9068c2]
??:? extern (C) clang.c.Index.CXChildVisitResult clang.Visitor.Visitor.visitorFunction(clang.c.Index.CXCursor, clang.c.Index.CXCursor, void*) [0x10f90620e]
??:? _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb [0x10ffb043d]
??:? _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE [0x10ffb1b28]
??:? _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE [0x10ffb1bb0]
??:? _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor [0x10ffb0c6c]
??:? clang_visitChildren [0x10ffb9a4f]
??:? int clang.Visitor.InOrderVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)) [0x10f9064cc]
??:? dstep.translator.Output.Output dstep.translator.Translator.Translator.translateCursors() [0x10f99669d]
??:? immutable(char)[] dstep.translator.Translator.Translator.translateToString() [0x10f996f3a]
??:? void dstep.translator.Translator.Translator.translate() [0x10f996519]
??:? int dstep.driver.Application.Application.run().__foreachbody5(std.typecons.Tuple!(immutable(char)[], immutable(char)[], clang.TranslationUnit.TranslationUnit).Tuple) [0x10f909859]
??:? void std.parallelism.ParallelForeach!(std.range.ZipShortest!(1, immutable(char)[][], immutable(char)[][], clang.TranslationUnit.TranslationUnit[]).ZipShortest).ParallelForeach.opApply(scope int delegate(std.typecons.Tuple!(immutable(char)[], immutable(char)[], clang.TranslationUnit.TranslationUnit).Tuple)).doIt() [0x10f90a2fb]
??:? void std.parallelism.run!(void delegate()).run(void delegate()) [0x10fa14f0f]
??:? void std.parallelism.Task!(std.parallelism.run, void delegate()).Task.impl(void*) [0x10fa149bf]
??:? void std.parallelism.AbstractTask.job() [0x10fa13312]
??:? void std.parallelism.submitAndExecute(std.parallelism.TaskPool, void delegate()) [0x10fa145c3]
??:? int std.parallelism.ParallelForeach!(std.range.ZipShortest!(1, immutable(char)[][], immutable(char)[][], clang.TranslationUnit.TranslationUnit[]).ZipShortest).ParallelForeach.opApply(scope int delegate(std.typecons.Tuple!(immutable(char)[], immutable(char)[], clang.TranslationUnit.TranslationUnit).Tuple)) [0x10f909f4b]
??:? void dstep.driver.Application.Application.run() [0x10f9096c1]
??:? int dstep.driver.CommandLine.run(immutable(char)[][]) [0x10f924397]
??:? _Dmain [0x10f8349f7]
core.exception.AssertError@dstep/translator/Type.d(623): Unhandled type kind objCTypeParam
----------------
??:? _d_assert_msg [0x10f9ce734]
??:? immutable(char)[] dstep.translator.Type.translateType(dstep.translator.Context.Context, clang.c.Index.CXTypeKind, bool) [0x10f9a3cae]
??:? dstep.translator.Output.SourceNode dstep.translator.Type.translateType(dstep.translator.Context.Context, clang.Cursor.Cursor, clang.Type.Type, bool, bool) [0x10f99edc2]
??:? dstep.translator.Output.SourceNode dstep.translator.Translator.translateFunction(dstep.translator.Context.Context, clang.Cursor.FunctionCursor, immutable(char)[], bool) [0x10f99bc9b]
??:? void dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translateMethod(clang.Cursor.FunctionCursor, bool, immutable(char)[]) [0x10f9b2014]
??:? int dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translate(dstep.translator.Output.Output).__lambda3().__foreachbody1(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) [0x10f9b078b]
??:? int function(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) clang.Visitor.DeclarationVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)).__foreachbody2 [0x10f906b51]
??:? extern (C) clang.c.Index.CXChildVisitResult clang.Visitor.Visitor.visitorFunction(clang.c.Index.CXCursor, clang.c.Index.CXCursor, void*) [0x10f90620e]
??:? _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb [0x10ffb043d]
??:? _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE [0x10ffb1b28]
??:? _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE [0x10ffb1bb0]
??:? _ZN5clang8cxcursor13CursorVisitor22VisitObjCInterfaceDeclEPNS_17ObjCInterfaceDeclE [0x10ffb3b9e]
??:? _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor [0x10ffb0ac9]
??:? clang_visitChildren [0x10ffb9a4f]
??:? int clang.Visitor.DeclarationVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)) [0x10f906aca]
??:? void dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translate(dstep.translator.Output.Output).__lambda3() [0x10f9b06f4]
??:? void dstep.translator.objc.ObjcInterface.ObjcInterface!(dstep.translator.Output.ClassData).ObjcInterface.translate(dstep.translator.Output.Output) [0x10f9b067e]
??:? void dstep.translator.Translator.Translator.translateObjCInterfaceDecl(dstep.translator.Output.Output, clang.Cursor.Cursor, clang.Cursor.Cursor) [0x10f99798d]
??:? void dstep.translator.Translator.Translator.translate(dstep.translator.Output.Output, clang.Cursor.Cursor, clang.Cursor.Cursor) [0x10f997287]
??:? void dstep.translator.Translator.Translator.translateInGlobalScope(dstep.translator.Output.Output, clang.Cursor.Cursor, clang.Cursor.Cursor) [0x10f997054]
??:? int dstep.translator.Translator.Translator.translateCursors().__foreachbody3(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) [0x10f996f07]
??:? int function(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor) clang.Visitor.InOrderVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)).__foreachbody11 [0x10f9068c2]
??:? extern (C) clang.c.Index.CXChildVisitResult clang.Visitor.Visitor.visitorFunction(clang.c.Index.CXCursor, clang.c.Index.CXCursor, void*) [0x10f90620e]
??:? _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb [0x10ffb043d]
??:? _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE [0x10ffb1b28]
??:? _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE [0x10ffb1bb0]
??:? _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor [0x10ffb0c6c]
??:? clang_visitChildren [0x10ffb9a4f]
??:? int clang.Visitor.InOrderVisitor.opApply(int delegate(ref clang.Cursor.Cursor, ref clang.Cursor.Cursor)) [0x10f9064cc]
??:? dstep.translator.Output.Output dstep.translator.Translator.Translator.translateCursors() [0x10f99669d]
??:? immutable(char)[] dstep.translator.Translator.Translator.translateToString() [0x10f996f3a]
??:? void dstep.translator.Translator.Translator.translate() [0x10f996519]
??:? int dstep.driver.Application.Application.run().__foreachbody5(std.typecons.Tuple!(immutable(char)[], immutable(char)[], clang.TranslationUnit.TranslationUnit).Tuple) [0x10f909859]
??:? void std.parallelism.ParallelForeach!(std.range.ZipShortest!(1, immutable(char)[][], immutable(char)[][], clang.TranslationUnit.TranslationUnit[]).ZipShortest).ParallelForeach.opApply(scope int delegate(std.typecons.Tuple!(immutable(char)[], immutable(char)[], clang.TranslationUnit.TranslationUnit).Tuple)).doIt() [0x10f90a2fb]
??:? void std.parallelism.run!(void delegate()).run(void delegate()) [0x10fa14f0f]
??:? void std.parallelism.Task!(std.parallelism.run, void delegate()).Task.impl(void*) [0x10fa149bf]
??:? void std.parallelism.AbstractTask.job() [0x10fa13312]
??:? void std.parallelism.submitAndExecute(std.parallelism.TaskPool, void delegate()) [0x10fa145c3]
??:? int std.parallelism.ParallelForeach!(std.range.ZipShortest!(1, immutable(char)[][], immutable(char)[][], clang.TranslationUnit.TranslationUnit[]).ZipShortest).ParallelForeach.opApply(scope int delegate(std.typecons.Tuple!(immutable(char)[], immutable(char)[], clang.TranslationUnit.TranslationUnit).Tuple)) [0x10f909f4b]
??:? void dstep.driver.Application.Application.run() [0x10f9096c1]
??:? int dstep.driver.CommandLine.run(immutable(char)[][]) [0x10f924397]
??:? _Dmain [0x10f8349f7]
jacob-carlborg commented 2 years ago

Which version of Clang is DStep linked with: dstep --clang-version?

JackStouffer commented 2 years ago

clang version 9.0.1