llcppsigfetch:func pointer

This commit is contained in:
luoliwoshang
2024-08-27 15:14:44 +08:00
parent a897683272
commit e57ee17532
7 changed files with 186 additions and 3 deletions

View File

@@ -148,6 +148,84 @@ TestStructDecl Case 3:
}
}
TestStructDecl Case 4:
{
"temp.h": {
"decls": [{
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "A"
},
"Type": {
"Tag": 0,
"Fields": {
"List": [{
"Type": {
"Kind": 6,
"Flags": 0
},
"Doc": {
"List": []
},
"Comment": {
"List": []
},
"Names": [{
"Name": "a"
}]
}, {
"Type": {
"X": {
"Params": {
"List": [{
"Type": {
"Kind": 6,
"Flags": 0
},
"Doc": null,
"Comment": null,
"Names": []
}, {
"Type": {
"Kind": 6,
"Flags": 0
},
"Doc": null,
"Comment": null,
"Names": []
}]
},
"Ret": {
"Kind": 6,
"Flags": 0
}
}
},
"Doc": {
"List": []
},
"Comment": {
"List": []
},
"Names": [{
"Name": "Foo"
}]
}]
},
"Methods": []
}
}],
"includes": [],
"macros": []
}
}
#stderr

View File

@@ -18,6 +18,10 @@ func TestStructDecl() {
`struct A {
int a, b;
};`,
`struct A {
int a;
int (*Foo)(int, int);
};`,
}
test.RunTest("TestStructDecl", testCases)
}

View File

@@ -61,6 +61,53 @@ TestTypeDefDecl Case 2:
}
}
TestTypeDefDecl Case 3:
{
"temp.h": {
"decls": [{
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "Foo"
},
"Type": {
"X": {
"Params": {
"List": [{
"Type": {
"Kind": 6,
"Flags": 0
},
"Doc": null,
"Comment": null,
"Names": []
}, {
"Type": {
"Kind": 6,
"Flags": 0
},
"Doc": null,
"Comment": null,
"Names": []
}]
},
"Ret": {
"Kind": 6,
"Flags": 0
}
}
}
}],
"includes": [],
"macros": []
}
}
#stderr

View File

@@ -12,6 +12,8 @@ func TestTypeDefDecl() {
`typedef int INT;
typedef INT STANDARD_INT;`,
`typedef int (*Foo)(int, int);`,
}
test.RunTest("TestTypeDefDecl", testCases)
}

View File

@@ -169,6 +169,34 @@ Type: class a::b::c:
},
"Tag": 3
}
Type: int (*)(int, char):
{
"X": {
"Params": {
"List": [{
"Type": {
"Kind": 6,
"Flags": 0
},
"Doc": null,
"Comment": null,
"Names": []
}, {
"Type": {
"Kind": 2,
"Flags": 1
},
"Doc": null,
"Comment": null,
"Names": []
}]
},
"Ret": {
"Kind": 6,
"Flags": 0
}
}
}
#stderr
todo: unknown builtin type: Ibm128

View File

@@ -111,6 +111,8 @@ func TestNonBuiltinTypes() {
}
}
class a::b::c`,
`int (*p)(int, char);`,
}
for _, t := range tests {