1
1
import copy
2
2
import os
3
3
import re
4
+ import sys
4
5
from typing import List
5
6
6
7
from clang .cindex import AccessSpecifier , Config , Cursor , CursorKind , TranslationUnit
@@ -83,6 +84,7 @@ def _extract_functions(self, cu: Cursor, namespace: List[str], module_name: str)
83
84
j : Cursor
84
85
if j .kind == CursorKind .PARM_DECL : # type: ignore
85
86
func .add_argument_type ((j .spelling , j .type .spelling ))
87
+ print ("\t | Function | " + func .signature ())
86
88
self ._funcitons .append (func )
87
89
88
90
def _extract_struct_and_class (
@@ -121,6 +123,7 @@ def _extract_struct_and_class(
121
123
j .brief_comment or "" ,
122
124
j .access_specifier == AccessSpecifier .PRIVATE , # type: ignore
123
125
)
126
+ print ("\t | Class | " + struct_or_class .signature ())
124
127
self ._structs_and_classes .append (struct_or_class )
125
128
126
129
def add_hpp_includes (self , hpp : str ):
@@ -143,10 +146,6 @@ def parse(
143
146
logger .error (
144
147
f"{ diag .location .file } :{ diag .location .line } :{ diag .location .column } : error: { diag .spelling } [{ diag .option } ]"
145
148
)
146
- if diag .severity == diag .Warning :
147
- logger .warn (
148
- f"{ diag .location .file } :{ diag .location .line } :{ diag .location .column } : warining: { diag .spelling } [{ diag .option } ]"
149
- )
150
149
if has_error :
151
150
exit (1 )
152
151
root : Cursor = tu .cursor
@@ -161,13 +160,14 @@ def visit(x: Cursor, namespace: List[str], module_name: str):
161
160
self ._extract_struct_and_class (x , namespace , module_name )
162
161
for i in list (x .get_children ()):
163
162
i : Cursor
164
- namespace_in = copy .copy (namespace )
163
+ namespace_in = copy .deepcopy (namespace )
165
164
if i .kind == CursorKind .NAMESPACE : # type: ignore
166
165
submod = Submodule ()
167
166
submod .set_name (i .spelling )
168
167
submod .set_description (i .brief_comment or "" )
169
- submod .set_parent (copy .copy (namespace_in ))
168
+ submod .set_parent (copy .deepcopy (namespace_in ))
170
169
if not submod in self ._submodules :
170
+ print (f"\t | Submodule | { submod .cpp_name } " )
171
171
self ._submodules .append (submod )
172
172
namespace_in .append (i .spelling )
173
173
visit (i , namespace_in , submod .cpp_name )
0 commit comments