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

Nikolai Kosjar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 06:46:20 PST 2018


nik added a comment.

I still don't have feedback for a real world case except "unintentional #include". Unfortunately, in real world cases the cyclic include might be not obvious at all.

@ilya: As far as I understand you prefer to make the preamble generation rather fail as long as we don't have more information. How do you suggest to implement this? I see that Clang->getPreprocessor().addPPCallbacks() is called in PrecompiledPreamble::Build(). Adding a custom PPCallbacks there that overrides "void InclusionDirective()" might be enough to detect the cyclic #include and to set a flag that is checked before PrecompiledPreamble::Build() returns - BuildPreambleError could get a new enumerator. Is there a better way to do this? For example, it would be desirable to not only observe this case, but then to also stop/abort/skip all the further parsing that is done for the preamble only as it's pointless then.


Repository:
  rC Clang

https://reviews.llvm.org/D53866





More information about the cfe-commits mailing list