Interesting. Thanks for the info! I never heard of this tool.
I think it's worthy of investigation. I will add this idea into my TODO list.
- Yang On 6/24/12 7:02 PM, Konstantin Tokarev wrote:
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. Assuming that "interesting" fragment of code is located in sections with big numbers (source file and local headers) while first sections contain library headers, this approach might be more efficient than traditional line-based reduction. [1] http://code.google.com/p/include-what-you-use
