diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-05-08 15:57:46 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-05-21 08:58:15 +0000 |
commit | c12b012bb7465299490cf93c2ae90499a5c417d5 (patch) | |
tree | cee38ab622df44c9f864c5585981aa9e55ffa3bf /include | |
parent | a59b84774f7c0b92f93a274d4f342c032b7ebda3 (diff) |
[backported/clang-9][Preamble] Stop circular inclusion of main file when building preamblerelease_80-based
--------------------------------------------------------------------------
https://reviews.llvm.org/D53866
--------------------------------------------------------------------------
If a header file was processed for the second time, we could end up with
a wrong conditional stack and skipped ranges:
In the particular example, if the header guard is evaluated the second
time and it is decided to skip the conditional block, the corresponding
"#endif" is never seen since the preamble does not include it and we end
up in the Tok.is(tok::eof) case with a wrong conditional stack.
Detect the circular inclusion, emit a diagnostic and stop processing the
inclusion.
Fixes: QTCREATORBUG-20883
Change-Id: I02644ddb507db4033dd5c69920c8e10500f0121c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 14e306246b..35df2d3826 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -421,6 +421,8 @@ def err_pp_file_not_found_typo_not_fatal : Error<"'%0' file not found, did you mean '%1'?">; def err_pp_error_opening_file : Error< "error opening file '%0': %1">, DefaultFatal; +def err_pp_including_mainfile_in_preamble : Error< + "main file cannot be included recursively when building a preamble">; def err_pp_empty_filename : Error<"empty filename">; def err_pp_include_too_deep : Error<"#include nested too deeply">; def err_pp_expects_filename : Error<"expected \"FILENAME\" or <FILENAME>">; |