What you need to reorganize your C ++ code database is a tool that can parse C ++ by saving header files, but following #includes and processing them. You must build an “a-depends-on-b” mapping for each pair of dependent elements, and then you must group them. Finally, you should be able to restore the source code according to clustering.
And you want to do this on a complete code base, not just with one compilation unit.
This is a pretty complicated search tool: -} I don’t think you will find it off the shelf.
Our DMS software reengineering toolkit has most of this. This is a general system for analyzing and transforming programs, has a complete C ++ interface and has a managed preprocessor, so it can expand / not expand #includes as necessary. It can capture a-depends-on-b relationships (we did it on a C-system of 26 million lines of code), and it has a proven ability to symbolically symbolize preprocessor conditions; it is possible to capture "a-depends-on-b if".
With this information, you need clustering. I think that for this you need some general clustering algorithm, and some user-defined ones are introduced to override it ("I insist, leave this #include file alone, and these two unbound unrelated things go together"). Then part of the ransformation DMS program can be used to mechanically separate code and include files in grouped dependent declarations.
DMS is a sophisticated tool; after all, it has to deal with such unpleasant things like C ++. Setting it up to perform the above tasks is not trivial, but I think it is within reach.
However, none of this will help you with your immediate problem of acquiring a tool that will help you solve your problem today.
source share