@@ -229,7 +229,9 @@ func (ct *Converter) visitTop(cursor, parent clang.Cursor) clang.ChildVisitResul
229229 inFile := ct .InFile (cursor )
230230
231231 name := toStr (cursor .String ())
232- ct .logf ("visitTop: Cursor: %s\n " , name )
232+ if dbg .GetDebugVisitTop () {
233+ ct .logf ("visitTop: Cursor: %s\n " , name )
234+ }
233235
234236 if ! inFile {
235237 return clang .ChildVisit_Continue
@@ -243,17 +245,23 @@ func (ct *Converter) visitTop(cursor, parent clang.Cursor) clang.ChildVisitResul
243245 return clang .ChildVisit_Continue
244246 }
245247 ct .Pkg .File .Includes = append (ct .Pkg .File .Includes , include )
246- ct .logln ("visitTop: ProcessInclude END " , include .Path )
248+ if dbg .GetDebugVisitTop () {
249+ ct .logln ("visitTop: ProcessInclude END " , include .Path )
250+ }
247251 case clang .CursorMacroDefinition :
248252 macro := ct .ProcessMacro (cursor )
249253 if cursor .IsMacroBuiltin () == 0 {
250254 ct .Pkg .File .Macros = append (ct .Pkg .File .Macros , macro )
251255 }
252- ct .logln ("visitTop: ProcessMacro END " , macro .Name , "Tokens Length:" , len (macro .Tokens ))
256+ if dbg .GetDebugVisitTop () {
257+ ct .logln ("visitTop: ProcessMacro END " , macro .Name , "Tokens Length:" , len (macro .Tokens ))
258+ }
253259 case clang .CursorEnumDecl :
254260 enum := ct .ProcessEnumDecl (cursor )
255261 ct .Pkg .File .Decls = append (ct .Pkg .File .Decls , enum )
256- ct .logf ("visitTop: ProcessEnumDecl END" )
262+ if dbg .GetDebugVisitTop () {
263+ ct .logf ("visitTop: ProcessEnumDecl END" )
264+ }
257265 if enum .Name != nil {
258266 ct .logln (enum .Name .Name )
259267 } else {
@@ -264,11 +272,15 @@ func (ct *Converter) visitTop(cursor, parent clang.Cursor) clang.ChildVisitResul
264272 classDecl := ct .ProcessClassDecl (cursor )
265273 ct .Pkg .File .Decls = append (ct .Pkg .File .Decls , classDecl )
266274 // class havent anonymous situation
267- ct .logln ("visitTop: ProcessClassDecl END" , classDecl .Name .Name )
275+ if dbg .GetDebugVisitTop () {
276+ ct .logln ("visitTop: ProcessClassDecl END" , classDecl .Name .Name )
277+ }
268278 case clang .CursorStructDecl :
269279 structDecl := ct .ProcessStructDecl (cursor )
270280 ct .Pkg .File .Decls = append (ct .Pkg .File .Decls , structDecl )
271- ct .logf ("visitTop: ProcessStructDecl END" )
281+ if dbg .GetDebugVisitTop () {
282+ ct .logf ("visitTop: ProcessStructDecl END" )
283+ }
272284 if structDecl .Name != nil {
273285 ct .logln (structDecl .Name .Name )
274286 } else {
@@ -277,7 +289,9 @@ func (ct *Converter) visitTop(cursor, parent clang.Cursor) clang.ChildVisitResul
277289 case clang .CursorUnionDecl :
278290 unionDecl := ct .ProcessUnionDecl (cursor )
279291 ct .Pkg .File .Decls = append (ct .Pkg .File .Decls , unionDecl )
280- ct .logf ("visitTop: ProcessUnionDecl END" )
292+ if dbg .GetDebugVisitTop () {
293+ ct .logf ("visitTop: ProcessUnionDecl END" )
294+ }
281295 if unionDecl .Name != nil {
282296 ct .logln (unionDecl .Name .Name )
283297 } else {
@@ -288,14 +302,18 @@ func (ct *Converter) visitTop(cursor, parent clang.Cursor) clang.ChildVisitResul
288302 // Example: void MyClass::myMethod() { ... } out-of-class method
289303 funcDecl := ct .ProcessFuncDecl (cursor )
290304 ct .Pkg .File .Decls = append (ct .Pkg .File .Decls , funcDecl )
291- ct .logln ("visitTop: ProcessFuncDecl END" , funcDecl .Name .Name , funcDecl .MangledName , "isStatic:" , funcDecl .IsStatic , "isInline:" , funcDecl .IsInline )
305+ if dbg .GetDebugVisitTop () {
306+ ct .logln ("visitTop: ProcessFuncDecl END" , funcDecl .Name .Name , funcDecl .MangledName , "isStatic:" , funcDecl .IsStatic , "isInline:" , funcDecl .IsInline )
307+ }
292308 case clang .CursorTypedefDecl :
293309 typedefDecl := ct .ProcessTypeDefDecl (cursor )
294310 if typedefDecl == nil {
295311 return clang .ChildVisit_Continue
296312 }
297313 ct .Pkg .File .Decls = append (ct .Pkg .File .Decls , typedefDecl )
298- ct .logln ("visitTop: ProcessTypeDefDecl END" , typedefDecl .Name .Name )
314+ if dbg .GetDebugVisitTop () {
315+ ct .logln ("visitTop: ProcessTypeDefDecl END" , typedefDecl .Name .Name )
316+ }
299317 case clang .CursorNamespace :
300318 clangutils .VisitChildren (cursor , ct .visitTop )
301319 }
0 commit comments