diff --git a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect index 3a769e03..07225285 100644 --- a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect +++ b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect @@ -79,6 +79,83 @@ TestTypeDefDecl Case 2: } TestTypeDefDecl Case 3: +{ + "temp.h": { + "_Type": "File", + "decls": [{ + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": null, + "Name": { + "_Type": "Ident", + "Name": "INT" + }, + "Type": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + } + }, { + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": null, + "Name": { + "_Type": "Ident", + "Name": "IntPtr" + }, + "Type": { + "_Type": "PointerType", + "X": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + } + } + }, { + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": null, + "Name": { + "_Type": "Ident", + "Name": "IntArr" + }, + "Type": { + "_Type": "ArrayType", + "Elt": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + }, + "Len": null + } + }], + "includes": [], + "macros": [] + } +} + +TestTypeDefDecl Case 4: { "temp.h": { "_Type": "File", @@ -152,6 +229,294 @@ TestTypeDefDecl Case 3: } } +TestTypeDefDecl Case 5: +{ + "temp.h": { + "_Type": "File", + "decls": [{ + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": null, + "Name": { + "_Type": "Ident", + "Name": "Foo" + }, + "Type": { + "_Type": "PointerType", + "X": { + "_Type": "FuncType", + "Params": { + "_Type": "FieldList", + "List": [{ + "_Type": "Field", + "Type": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + }, + "Doc": null, + "Comment": null, + "IsStatic": false, + "Access": 0, + "Names": [] + }, { + "_Type": "Field", + "Type": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + }, + "Doc": null, + "Comment": null, + "IsStatic": false, + "Access": 0, + "Names": [] + }] + }, + "Ret": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + } + } + } + }, { + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": null, + "Name": { + "_Type": "Ident", + "Name": "Bar" + }, + "Type": { + "_Type": "PointerType", + "X": { + "_Type": "FuncType", + "Params": { + "_Type": "FieldList", + "List": [{ + "_Type": "Field", + "Type": { + "_Type": "PointerType", + "X": { + "_Type": "BuiltinType", + "Kind": 0, + "Flags": 0 + } + }, + "Doc": null, + "Comment": null, + "IsStatic": false, + "Access": 0, + "Names": [] + }, { + "_Type": "Field", + "Type": { + "_Type": "PointerType", + "X": { + "_Type": "BuiltinType", + "Kind": 0, + "Flags": 0 + } + }, + "Doc": null, + "Comment": null, + "IsStatic": false, + "Access": 0, + "Names": [] + }] + }, + "Ret": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + } + } + } + }], + "includes": [], + "macros": [] + } +} + +TestTypeDefDecl Case 6: +{ + "temp.h": { + "_Type": "File", + "decls": [{ + "_Type": "TypeDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + }, + "Name": { + "_Type": "Ident", + "Name": "Foo" + }, + "Type": { + "_Type": "RecordType", + "Tag": 3, + "Fields": { + "_Type": "FieldList", + "List": [{ + "_Type": "Field", + "Type": { + "_Type": "BuiltinType", + "Kind": 6, + "Flags": 0 + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Comment": { + "_Type": "CommentGroup", + "List": [] + }, + "IsStatic": false, + "Access": 3, + "Names": [{ + "_Type": "Ident", + "Name": "x" + }] + }] + }, + "Methods": [] + } + }, { + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + }, + "Name": { + "_Type": "Ident", + "Name": "MyClass" + }, + "Type": { + "_Type": "TagExpr", + "Name": { + "_Type": "ScopingExpr", + "X": { + "_Type": "Ident", + "Name": "Foo" + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + } + }, + "Tag": 3 + } + }, { + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + }, + "Name": { + "_Type": "Ident", + "Name": "MyClassPtr" + }, + "Type": { + "_Type": "PointerType", + "X": { + "_Type": "TagExpr", + "Name": { + "_Type": "ScopingExpr", + "X": { + "_Type": "Ident", + "Name": "Foo" + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + } + }, + "Tag": 3 + } + } + }, { + "_Type": "TypedefDecl", + "Loc": { + "_Type": "Location", + "File": "temp.h" + }, + "Doc": { + "_Type": "CommentGroup", + "List": [] + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + }, + "Name": { + "_Type": "Ident", + "Name": "MyClassArray" + }, + "Type": { + "_Type": "ArrayType", + "Elt": { + "_Type": "TagExpr", + "Name": { + "_Type": "ScopingExpr", + "X": { + "_Type": "Ident", + "Name": "Foo" + }, + "Parent": { + "_Type": "Ident", + "Name": "A" + } + }, + "Tag": 3 + }, + "Len": null + } + }], + "includes": [], + "macros": [] + } +} + #stderr diff --git a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go index 240fc660..27dd0f19 100644 --- a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go +++ b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go @@ -13,7 +13,17 @@ func TestTypeDefDecl() { `typedef int INT; typedef INT STANDARD_INT;`, + `typedef int INT,*IntPtr,IntArr[];`, + `typedef int (*Foo)(int, int, ...);`, + + `typedef int (*Foo)(int, int),(*Bar)(void*,void*);`, + + `namespace A { + typedef class Foo{ + int x; + } MyClass,*MyClassPtr,MyClassArray[]; + }`, } test.RunTest("TestTypeDefDecl", testCases) }