From a5c268491e3f1563098e5b8e1c879cdd7b8fe3eb Mon Sep 17 00:00:00 2001 From: luoliwoshang <2643523683@qq.com> Date: Wed, 20 Nov 2024 17:56:44 +0800 Subject: [PATCH] llcppsigfetch: test typedef anonymous enum with multiple type names --- .../decl_test/typedef_test/llgo.expect | 126 ++++++++++++++++++ .../decl_test/typedef_test/typedef.go | 6 + 2 files changed, 132 insertions(+) diff --git a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect index 76f40a5a..19eab45a 100644 --- a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect +++ b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/llgo.expect @@ -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", diff --git a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go index 623b4dde..c370c7cb 100644 --- a/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go +++ b/chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/typedef_test/typedef.go @@ -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 {