Suppose the following: `foo.cpp` refers to the symbol `Bar`, declared in `bar.h`. `foo.h` includes `bar.h`. `foo.cpp` includes `foo.h`, but not `bar.h`. `foo.h` does not refer to any symbols declared in `bar.h`. If we process `foo.h` first, `#include "bar.h"` will be removed, causing IWYU to fail with an error when it tries to process `foo.cpp`, but if we process them in the other order, `foo.cpp` will get that include before it gets removed from `foo.h`. This change sorts the files to be processed, putting all cpp files first, then all header files, minimizing that problem. We could do even better by saving the results from `include-what-you-use` for every file, then going back and calling `fix_includes.py` on each of them, but I don't think it's worth it. Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1162/head
parent
21d78160f4
commit
a7e6f3f072
Loading…
Reference in new issue