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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to