llcppsigfetch:typedecl name

This commit is contained in:
luoliwoshang
2024-08-20 14:19:48 +08:00
parent 1f72a52015
commit 697c21b120
3 changed files with 26 additions and 0 deletions

View File

@@ -427,6 +427,7 @@ func (ct *Converter) ProcessStructOrClass(cursor clang.Cursor, tag ast.Tag) *ast
decl := &ast.TypeDecl{ decl := &ast.TypeDecl{
DeclBase: ct.CreateDeclBase(cursor), DeclBase: ct.CreateDeclBase(cursor),
Tag: tag, Tag: tag,
Name: &ast.Ident{Name: c.GoString(name.CStr())},
Fields: fields, Fields: fields,
Methods: methods, Methods: methods,
} }

View File

@@ -554,6 +554,9 @@ TestScope Case 4:
"Name": "a" "Name": "a"
}, },
"Tag": 3, "Tag": 3,
"Name": {
"Name": "a"
},
"Fields": { "Fields": {
"List": [] "List": []
}, },
@@ -606,6 +609,9 @@ TestScope Case 5:
} }
}, },
"Tag": 3, "Tag": 3,
"Name": {
"Name": "b"
},
"Fields": { "Fields": {
"List": [] "List": []
}, },
@@ -952,6 +958,9 @@ TestStructDecl Case 1:
}, },
"Parent": null, "Parent": null,
"Tag": 0, "Tag": 0,
"Name": {
"Name": "A"
},
"Fields": { "Fields": {
"List": [{ "List": [{
"Type": { "Type": {
@@ -1003,6 +1012,9 @@ TestStructDecl Case 2:
}, },
"Parent": null, "Parent": null,
"Tag": 0, "Tag": 0,
"Name": {
"Name": "A"
},
"Fields": { "Fields": {
"List": [{ "List": [{
"Type": { "Type": {
@@ -1054,6 +1066,9 @@ TestStructDecl Case 3:
}, },
"Parent": null, "Parent": null,
"Tag": 0, "Tag": 0,
"Name": {
"Name": "A"
},
"Fields": { "Fields": {
"List": [{ "List": [{
"Type": { "Type": {
@@ -1155,6 +1170,9 @@ TestClassDecl Case 1:
"Name": "A" "Name": "A"
}, },
"Tag": 3, "Tag": 3,
"Name": {
"Name": "A"
},
"Fields": { "Fields": {
"List": [{ "List": [{
"Type": { "Type": {
@@ -1208,6 +1226,9 @@ TestClassDecl Case 2:
"Name": "A" "Name": "A"
}, },
"Tag": 3, "Tag": 3,
"Name": {
"Name": "A"
},
"Fields": { "Fields": {
"List": [{ "List": [{
"Type": { "Type": {
@@ -1309,6 +1330,9 @@ TestUnionDecl Case 1:
}, },
"Parent": null, "Parent": null,
"Tag": 1, "Tag": 1,
"Name": {
"Name": "A"
},
"Fields": { "Fields": {
"List": [{ "List": [{
"Type": { "Type": {

View File

@@ -81,6 +81,7 @@ func MarshalASTDecl(decl ast.Decl) *cjson.JSON {
case *ast.TypeDecl: case *ast.TypeDecl:
MarshalASTDeclBase(d.DeclBase, root) MarshalASTDeclBase(d.DeclBase, root)
root.SetItem(c.Str("Tag"), cjson.Number(float64(d.Tag))) root.SetItem(c.Str("Tag"), cjson.Number(float64(d.Tag)))
root.SetItem(c.Str("Name"), MarshalASTExpr(d.Name))
root.SetItem(c.Str("Fields"), MarshalASTExpr(d.Fields)) root.SetItem(c.Str("Fields"), MarshalASTExpr(d.Fields))
methods := cjson.Array() methods := cjson.Array()
for _, m := range d.Methods { for _, m := range d.Methods {