Recent

Author Topic: Detect orphaned procedures and functions  (Read 352 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Detect orphaned procedures and functions
« on: December 09, 2025, 08:43:42 pm »
Hi,

Is there an option to find orphan procedure or function in the code? Maybe I'm looking badly but I can't find anything like that in the ide. When I'm trying/testing, I sometimes forget to remove a procedure that has become redundant and then it just stays in the code. Now I use Find in Files but that is a bit cumbersome for something like that.

dsiders

  • Hero Member
  • *****
  • Posts: 1509
Re: Detect orphaned procedures and functions
« Reply #1 on: December 09, 2025, 11:27:48 pm »
Hi,

Is there an option to find orphan procedure or function in the code? Maybe I'm looking badly but I can't find anything like that in the ide. When I'm trying/testing, I sometimes forget to remove a procedure that has become redundant and then it just stays in the code. Now I use Find in Files but that is a bit cumbersome for something like that.

What you're looking for is a profiler - and no there is not one in the default Lazarus installation. The options appear to be LazProfiler (stale), FPProfile (stale), and ValGrind (Linux). Use the forum search option, or Google Search.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12010
  • Debugger - SynEdit - and more
    • wiki
Re: Detect orphaned procedures and functions
« Reply #2 on: December 09, 2025, 11:37:51 pm »
Actually just the presence of references could be implemented using codetools (like findref on each proc / would take some time to execute)
But well, it hasn't been done.

WPO afaik gathers the info somehow (to then drop them). IIRC, it may get this from the linker. But I have no background on that.

 

TinyPortal © 2005-2018