Very nice. One potential application of this in the future would be to not only sequence the included files, but also the symbols and types. To support the cases where a child include depends on symbols exported by the parent before its inclusion (though I'm not sure we want to really support that).
OK with the changes below. http://codereview.appspot.com/4908051/diff/1/gcc/cp/pph-streamer-in.c File gcc/cp/pph-streamer-in.c (right): http://codereview.appspot.com/4908051/diff/1/gcc/cp/pph-streamer-in.c#newcode1402 gcc/cp/pph-streamer-in.c:1402: gcc_assert(lm->included_from == -1); Space before '(' http://codereview.appspot.com/4908051/diff/1/gcc/cp/pph-streamer-out.c File gcc/cp/pph-streamer-out.c (right): http://codereview.appspot.com/4908051/diff/1/gcc/cp/pph-streamer-out.c#newcode1211 gcc/cp/pph-streamer-out.c:1211: header_name = header_path + 1; Actually, you can use lbasename from libiberty. You can then figure out the extension with strrchr. I forgot to tell you about it, sorry. http://codereview.appspot.com/4908051/diff/1/gcc/cp/pph-streamer-out.c#newcode1328 gcc/cp/pph-streamer-out.c:1328: #ifdef and only enabled if asserts are on. */ Actually, leave it in permanently. Changing the output of the compiler depending on whether checking is enabled is bad ju-ju. An extra int at the end of the line table will not hurt. http://codereview.appspot.com/4908051/