This would be interesting to try, but it's way too much work for me. As
the supervisor here, I only tackle easy programming projects.
It's possible that Yang could make time for this.
John
On 06/27/2012 07:21 AM, Konstantin Tokarev wrote:
27.06.2012, 17:17, "Konstantin Tokarev" <[email protected]>:
24.06.2012, 15:02, "Konstantin Tokarev" <[email protected]>:
Hi all,
As you may know, there is a clang-based tool "Include What You Use" [1]. I
think similar approach could be useful in C-Reduce to remove whole header files instead
of separate lines. Though I'm not sure it's feasible without non-preprocessed source file
and compilation command line available.
I can imagine the next algorithm of reduction:
1. Reduce only the last section of translation unit corresponding to original
source file without #includes using all available passes.
2. Try to remove sections corresponding to "unused" headers
3. Move to section N-1 and proceed.
Algorithm without file-level logic:
0. Remove empty lines
1. Reduce part of translation unit after last line starting with '#' using all
available passes.
2. Aggressively eliminate / replace with forward declaration any unused
function / classes.
And, most important, unused templates.
3. Move to the next non-empty section between lines starting with '#'