diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2018-12-07 20:29:54 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2018-12-07 20:29:54 +0000 |
commit | 24a89effee8446ebcb8fec549855358db6490312 (patch) | |
tree | 1e192f88c9616baa78c2a858098a4947c844b00b /include/clang/Lex | |
parent | af59bfdfc36222037c8f3ba0d868119f6910760e (diff) |
[Preprocessor] Don't avoid entering included files after hitting a fatal error.
Change in r337953 violated the contract for `CXTranslationUnit_KeepGoing`:
> Do not stop processing when fatal errors are encountered.
Use different approach to fix long processing times with multiple inclusion
cycles. Instead of stopping preprocessing for fatal errors, do this after
reaching the max allowed include depth and only for the files that were
processed already. It is likely but not guaranteed those files cause a cycle.
rdar://problem/46108547
Reviewers: erik.pilkington, arphaman
Reviewed By: erik.pilkington
Subscribers: jkorous, dexonsmith, ilya-biryukov, Dmitry.Kozhevnikov
Differential Revision: https://reviews.llvm.org/D55095
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 792f8af7da..64ddb5307f 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -319,6 +319,10 @@ class Preprocessor { /// This is used when loading a precompiled preamble. std::pair<int, bool> SkipMainFilePreamble; + /// Whether we hit an error due to reaching max allowed include depth. Allows + /// to avoid hitting the same error over and over again. + bool HasReachedMaxIncludeDepth = false; + public: struct PreambleSkipInfo { SourceLocation HashTokenLoc; |