llcppsigfetch:collect func param name
This commit is contained in:
@@ -10,17 +10,30 @@ func main() {
|
||||
}
|
||||
|
||||
func TestFuncDecl() {
|
||||
content := `int foo(int a, int b);`
|
||||
converter, err := parse.NewConverter(content, true)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
testCases := []string{
|
||||
`void foo();`,
|
||||
`void foo(int a);`,
|
||||
`float foo(int a,double b);`,
|
||||
|
||||
`void foo(char* str, double x);`,
|
||||
`float* foo(char* str, double x);`,
|
||||
`float* foo(char*** str, double x);`,
|
||||
}
|
||||
|
||||
defer converter.Dispose()
|
||||
converter.Convert()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
for i, content := range testCases {
|
||||
converter, err := parse.NewConverter(content, true)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = converter.Convert()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
json := converter.GetFilesJSON()
|
||||
c.Printf(c.Str("Test Case %d:\n%s\n\n"), c.Int(i+1), json.Print())
|
||||
|
||||
converter.Dispose()
|
||||
}
|
||||
json := converter.GetFilesJSON()
|
||||
c.Printf(c.Str("%s\n"), json.Print())
|
||||
}
|
||||
|
||||
@@ -1,30 +1,265 @@
|
||||
#stdout
|
||||
Test Case 1:
|
||||
{
|
||||
"Files": {
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Name": "foo",
|
||||
"Type": {
|
||||
"Params": [{
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Loc": null,
|
||||
"Doc": null,
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": []
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 0,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
Test Case 2:
|
||||
{
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Loc": null,
|
||||
"Doc": null,
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "a"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 0,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
Test Case 3:
|
||||
{
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Loc": null,
|
||||
"Doc": null,
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "a"
|
||||
}]
|
||||
}, {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
}],
|
||||
"Ret": {
|
||||
"Kind": 6,
|
||||
"Type": {
|
||||
"Kind": 8,
|
||||
"Flags": 16
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "b"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 8,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
Test Case 4:
|
||||
{
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Loc": null,
|
||||
"Doc": null,
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"X": {
|
||||
"Kind": 2,
|
||||
"Flags": 1
|
||||
}
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "str"
|
||||
}]
|
||||
}, {
|
||||
"Type": {
|
||||
"Kind": 8,
|
||||
"Flags": 16
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "x"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 0,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
Test Case 5:
|
||||
{
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Loc": null,
|
||||
"Doc": null,
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"X": {
|
||||
"Kind": 2,
|
||||
"Flags": 1
|
||||
}
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "str"
|
||||
}]
|
||||
}, {
|
||||
"Type": {
|
||||
"Kind": 8,
|
||||
"Flags": 16
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "x"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"X": {
|
||||
"Kind": 8,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
Test Case 6:
|
||||
{
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Loc": null,
|
||||
"Doc": null,
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"X": {
|
||||
"X": {
|
||||
"X": {
|
||||
"Kind": 2,
|
||||
"Flags": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "str"
|
||||
}]
|
||||
}, {
|
||||
"Type": {
|
||||
"Kind": 8,
|
||||
"Flags": 16
|
||||
},
|
||||
"Doc": null,
|
||||
"Comment": null,
|
||||
"Names": [{
|
||||
"Name": "x"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"X": {
|
||||
"Kind": 8,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#stderr
|
||||
|
||||
#exit 0
|
||||
|
||||
Reference in New Issue
Block a user