llcppsigfetch:tag expr

This commit is contained in:
luoliwoshang
2024-08-22 15:57:21 +08:00
parent a4f850c0c6
commit eb4d721175
4 changed files with 196 additions and 13 deletions

View File

@@ -194,6 +194,151 @@ TestTypeDefDecl Case 3:
}
}
TestTypeDefDecl Case 4:
{
"temp.h": {
"decls": [{
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "StructFoo"
},
"Type": {
"Tag": 0,
"Fields": {
"List": []
},
"Methods": []
}
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "UnionFoo"
},
"Type": {
"Tag": 1,
"Fields": {
"List": []
},
"Methods": []
}
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": {
"Name": "ClassFoo"
},
"Name": {
"Name": "ClassFoo"
},
"Type": {
"Tag": 3,
"Fields": {
"List": []
},
"Methods": []
}
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "EnumFoo"
},
"Items": []
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "STRUCT_FOO"
},
"Type": {
"Name": {
"Name": "StructFoo"
},
"Tag": 0
}
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "UNION_FOO"
},
"Type": {
"Name": {
"Name": "UnionFoo"
},
"Tag": 1
}
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "CLASS_FOO"
},
"Type": {
"Name": {
"Name": "ClassFoo"
},
"Tag": 3
}
}, {
"Loc": {
"File": "temp.h"
},
"Doc": {
"List": []
},
"Parent": null,
"Name": {
"Name": "ENUM_FOO"
},
"Type": {
"Name": {
"Name": "EnumFoo"
},
"Tag": 2
}
}],
"includes": [],
"macros": []
}
}
#stderr

View File

@@ -10,6 +10,7 @@ func TestTypeDefDecl() {
testCases := []string{
`typedef int INT;`,
`typedef int INT;
typedef INT STANDARD_INT;`,
`struct StructFoo {};
union UnionFoo {};
@@ -19,6 +20,15 @@ func TestTypeDefDecl() {
typedef UnionFoo UNION_FOO;
typedef ClassFoo CLASS_FOO;
typedef EnumFoo ENUM_FOO;`,
`struct StructFoo {};
union UnionFoo {};
class ClassFoo {};
enum EnumFoo {};
typedef struct StructFoo STRUCT_FOO;
typedef union UnionFoo UNION_FOO;
typedef class ClassFoo CLASS_FOO;
typedef enum EnumFoo ENUM_FOO;`,
}
test.RunTest("TestTypeDefDecl", testCases)
}