Skip to content

Commit 4c1849d

Browse files
waskyosipma
authored andcommitted
fix bug when collecting compinfos for global types
a typedef will return True if its underlying type is a struct, but it does not also proxy compinfo, so we need to check for that case first, 'deref' (so to speak) the typedef, and then we should be able to access the compinfo This seems to have been triggered by a header with this type definition: ``` typedef struct ___sigset_t __sigset_t; ```
1 parent b31ce1b commit 4c1849d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

chb/bctypes/BCFiles.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from chb.bctypes.BCDictionary import BCDictionary
3535
from chb.bctypes.BCEnumInfo import BCEnumInfo
3636
from chb.bctypes.BCFunctionDefinition import BCFunctionDefinition
37-
from chb.bctypes.BCTyp import BCTyp, BCTypComp
37+
from chb.bctypes.BCTyp import BCTyp, BCTypComp, BCTypNamed
3838
from chb.bctypes.BCTypeInfo import BCTypeInfo
3939
from chb.bctypes.BCVarInfo import BCVarInfo
4040

@@ -81,6 +81,10 @@ def genumtags(self) -> List[BCEnumInfo]:
8181
def fsum_compinfos(self) -> List[BCCompInfo]:
8282
result: List[BCCompInfo] = []
8383
for typ in self.gtypes:
84+
if typ.is_typedef:
85+
typedef = cast("BCTypNamed", typ).typedef
86+
if typedef:
87+
typ = typ = cast("BCTypeInfo", typedef).ttype
8488
if typ.is_struct:
8589
compinfo = cast("BCTypComp", typ).compinfo
8690
result.append(compinfo)

0 commit comments

Comments
 (0)