From d30b6383beb0d7e585eaf15ec71b9289a6f2efca Mon Sep 17 00:00:00 2001 From: Erwei Deng Date: Sat, 16 Apr 2022 17:48:39 +0800 Subject: [PATCH] border: fixed the extraction bug about typedef struct The gcc.PointerType needs to be dereferenced. Fixes: 481a3273(border: fixed Gcc bugs about typedef struct and va_list arguments) Signed-off-by: Erwei Deng --- sched_boundary/sched_boundary.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sched_boundary/sched_boundary.py b/sched_boundary/sched_boundary.py index e312884..4a506fd 100644 --- a/sched_boundary/sched_boundary.py +++ b/sched_boundary/sched_boundary.py @@ -54,8 +54,13 @@ class GccBugs(object): @staticmethod def typedef(decl, str): - if isinstance(decl.type.name, gcc.TypeDecl): - name = decl.type.name.name + t = decl.type + + while isinstance(t, (gcc.PointerType, gcc.ArrayType)): + t = t.dereference + + if isinstance(t.name, gcc.TypeDecl): + name = t.name.name return str.replace('struct ' + name, name) else: return str -- Gitee