llcppsigfetch: test typedef anonymous enum with multiple type names

This commit is contained in:
luoliwoshang
2024-11-20 17:56:44 +08:00
parent bf34f553bb
commit a5c268491e
2 changed files with 132 additions and 0 deletions

View File

@@ -737,6 +737,132 @@ TestTypeDefDecl Case 10:
}
TestTypeDefDecl Case 11:
{
"temp.h": {
"_Type": "File",
"decls": [{
"_Type": "EnumTypeDecl",
"Loc": {
"_Type": "Location",
"File": "temp.h"
},
"Doc": null,
"Parent": null,
"Name": {
"_Type": "Ident",
"Name": "MyEnum"
},
"Type": {
"_Type": "EnumType",
"Items": [{
"_Type": "EnumItem",
"Name": {
"_Type": "Ident",
"Name": "RED"
},
"Value": {
"_Type": "BasicLit",
"Kind": 0,
"Value": "0"
}
}, {
"_Type": "EnumItem",
"Name": {
"_Type": "Ident",
"Name": "GREEN"
},
"Value": {
"_Type": "BasicLit",
"Kind": 0,
"Value": "1"
}
}, {
"_Type": "EnumItem",
"Name": {
"_Type": "Ident",
"Name": "BLUE"
},
"Value": {
"_Type": "BasicLit",
"Kind": 0,
"Value": "2"
}
}]
}
}, {
"_Type": "TypedefDecl",
"Loc": {
"_Type": "Location",
"File": "temp.h"
},
"Doc": null,
"Parent": null,
"Name": {
"_Type": "Ident",
"Name": "MyEnum2"
},
"Type": {
"_Type": "TagExpr",
"Name": {
"_Type": "Ident",
"Name": "MyEnum"
},
"Tag": 2
}
}, {
"_Type": "TypedefDecl",
"Loc": {
"_Type": "Location",
"File": "temp.h"
},
"Doc": null,
"Parent": null,
"Name": {
"_Type": "Ident",
"Name": "EnumPtr"
},
"Type": {
"_Type": "PointerType",
"X": {
"_Type": "TagExpr",
"Name": {
"_Type": "Ident",
"Name": "MyEnum"
},
"Tag": 2
}
}
}, {
"_Type": "TypedefDecl",
"Loc": {
"_Type": "Location",
"File": "temp.h"
},
"Doc": null,
"Parent": null,
"Name": {
"_Type": "Ident",
"Name": "EnumArr"
},
"Type": {
"_Type": "ArrayType",
"Elt": {
"_Type": "TagExpr",
"Name": {
"_Type": "Ident",
"Name": "MyEnum"
},
"Tag": 2
},
"Len": null
}
}],
"includes": [],
"macros": []
}
}
TestTypeDefDecl Case 12:
{
"temp.h": {
"_Type": "File",

View File

@@ -41,6 +41,12 @@ func TestTypeDefDecl() {
int x;
} MyStruct,MyStruct2,*StructPtr, StructArr[];`,
`typedef enum {
RED,
GREEN,
BLUE
} MyEnum,MyEnum2,*EnumPtr,EnumArr[];`,
`namespace A{
namespace B{
typedef struct {