[PATCH] D48786: [Preprocessor] Stop entering included files after hitting a fatal error.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 18 16:14:39 PDT 2018
vsapsai added inline comments.
================
Comment at: clang/lib/Lex/PPDirectives.cpp:1875
+ // Stop further preprocessing if a fatal error has occurred. Any diagnostics
+ // we might have raised will not be visible.
+ if (ShouldEnter && Diags->hasFatalErrorOccurred())
----------------
jkorous wrote:
> I am not sure I understand this - does that mean that we are not displaying diagnostics that were produced before "now"?
I can see how the wording can cause the confusion. But I'm not entirely sure it is misguiding, I've copy-pasted it from [Sema::InstantiatingTemplate::InstantiatingTemplate ](https://github.com/llvm-mirror/clang/blob/580f7daabc7696d50ad09d9643b2afeadbd387d8/lib/Sema/SemaTemplateInstantiate.cpp#L218-L220). Let me explain my reasoning in a different way to see if it makes sense. Entering a file is observable if it produces diagnostics or some other build artifact (object file in most cases). So when we encounter a fatal error, there is no visible indication of entering subsequent files. That's why we can skip entering those files: no difference in output and less work to do.
https://reviews.llvm.org/D48786
More information about the cfe-commits
mailing list