[PATCH] D50462: Try building complete AST after a fatal error was emitted if further diagnostics are expected
Dmitry via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 8 10:05:47 PDT 2018
Dmitry.Kozhevnikov created this revision.
Dmitry.Kozhevnikov added reviewers: ilya-biryukov, sammccall, milianw.
Herald added subscribers: cfe-commits, ioeric.
Related to https://reviews.llvm.org/D50455
There is some code here and there that assume that no sane output is required if a fatal error has occurred. When using clangd/libclang, it's no longer true: diagnostics might still be requested, and AST might still be required for other IDE/tooling features, so it has to be as complete as possible.
Here I try to separate the following use cases:
1. Some clients check `hasFatalErrorOccurred()` because they are known to work unstable in presence of compile errors and want to mitigate it - they'll work as before
2. However, we don't want to take shortcuts in PP and Sema and still want to process include directives and instantiate templates
Note: I've found out that initially the flag in `DiagnosticsEngine` (which is now called `SuppressAfterFatalError`) had different meaning and was just demoting all fatal errors to non-fatal (https://reviews.llvm.org/rL262318). This would also fix this issue, however, it was partly reverted in https://reviews.llvm.org/rL301992 to the current state. Maybe we should go with the old approach instead (I assume the issue was that this flag was not serialized/restored, but probably should?)
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D50462
Files:
include/clang/Basic/Diagnostic.h
lib/Lex/PPDirectives.cpp
lib/Sema/SemaTemplateInstantiate.cpp
unittests/Frontend/PCHPreambleTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50462.159742.patch
Type: text/x-patch
Size: 4660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180808/258092d8/attachment-0001.bin>
More information about the cfe-commits
mailing list