[PATCH] D53866: [Preamble] Fix preamble for circular #includes

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 07:54:14 PDT 2018


ilya-biryukov added a comment.

> Because this case can be detected and handled without loosing the benefits of the preamble.

The cases where recursive includes make sense are incredibly rare in practice. Most of the time, recursively including the same file is unintentional should be considered a bug and fixed.
Producing a warning that the file is being recursively included (along with an include chain that caused a recursive inclusion) seems to provide more benefit than preamble, especially when this is unintentional (I would argue that's the majority of the cases).

> If we are in preamble-generation-mode and the main file #includes itself, then it should see the full file content of the file, not the truncated preamble version of it.
>  Would this be more consistent?

Yes, but I can't see an easy way to make it happen. And I don't think we want a complex fix for something bizzare that very rarely happens in practice.


Repository:
  rC Clang

https://reviews.llvm.org/D53866





More information about the cfe-commits mailing list