When an include is not found (even if it's not needed at all), then the semantic analysis, highlighting, code completion, etc. becomes seriously broken. It seems that clang internally just stops processing the translation-unit at some point and leaves it half-processed. Ideally this would be fixed in clang so that such situations are handled more gracefully. But before that, given how serious the implications are, KDevelop's problem reporter should at least show an error, pointing out the problem. Currently, when the #include was missing in a recursively included header, then the problem-reporter stays completely empty, leaving the user cluelessly with a half-processed document. Reproducible: Always
Agreed, on all parts. Esp. considering that we already offer a simple workaround for such problems (i.e. add manual include path), we should just show this to the user when we spot such an error anywhere in the include chain.
Git commit 7bdc9e8d9539c6e904edbd021d0cc359cdc8e843 by David Nolden. Committed on 01/02/2016 at 15:53. Pushed by zwabel into branch 'master'. Add a testcase for BUG: 358853 It seems to break as soon as the second missing include is encountered. M +45 -0 languages/clang/tests/test_duchain.cpp M +1 -0 languages/clang/tests/test_duchain.h http://commits.kde.org/kdevelop/7bdc9e8d9539c6e904edbd021d0cc359cdc8e843
Maybe related upstream issue: https://llvm.org/bugs/show_bug.cgi?id=24268
Git commit a1d6a13183c01b9ea2c45e470e81f9ec53df7ada by David Nolden. Committed on 01/02/2016 at 18:11. Pushed by zwabel into branch 'master'. Always show recursive "missing include" errors in problem view Extend the missing-include test so that it becomes a recursive include and also tests this fix. The problem is only actually visible together with my previous commit to kdevplatform. M +3 -1 languages/clang/duchain/parsesession.cpp M +12 -7 languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/a1d6a13183c01b9ea2c45e470e81f9ec53df7ada
Git commit c9dcbaeedef2ec746214d1be91a09293492e4abb by David Nolden. Committed on 01/02/2016 at 18:15. Pushed by zwabel into branch '5.0'. Add a testcase for BUG: 358853 It seems to break as soon as the second missing include is encountered. M +45 -0 languages/clang/tests/test_duchain.cpp M +1 -0 languages/clang/tests/test_duchain.h http://commits.kde.org/kdevelop/c9dcbaeedef2ec746214d1be91a09293492e4abb
Git commit e90e1864039d8ea3c045d64dc35d117060c950b1 by David Nolden. Committed on 01/02/2016 at 18:15. Pushed by zwabel into branch '5.0'. Always show recursive "missing include" errors in problem view Extend the missing-include test so that it becomes a recursive include and also tests this fix. The problem is only actually visible together with my previous commit to kdevplatform. M +3 -1 languages/clang/duchain/parsesession.cpp M +12 -7 languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/e90e1864039d8ea3c045d64dc35d117060c950b1
Git commit 0b506dcbee4c15d4e0f19308364f50cc19dcdbd2 by David Nolden. Committed on 01/02/2016 at 22:13. Pushed by zwabel into branch 'master'. Workaround clang parsing problems when includes are missing When an include was missing in a parse run, then the corresponding include directive is removed from the parse using the unsaved-file mechanism, and the document is re-parsed. This is repeated until no more missing includes are found. The corresponding missing-include problems are shown in the problem-reporter anyway, so the user can fix it. M +2 -0 languages/clang/clangparsejob.cpp M +71 -4 languages/clang/duchain/parsesession.cpp M +9 -0 languages/clang/duchain/parsesession.h M +11 -0 languages/clang/duchain/unsavedfile.cpp M +4 -0 languages/clang/duchain/unsavedfile.h M +1 -5 languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/0b506dcbee4c15d4e0f19308364f50cc19dcdbd2
Git commit 1dffa94f333098bca2830c9da96367156fc9b505 by David Nolden. Committed on 03/02/2016 at 22:18. Pushed by zwabel into branch '5.0'. Workaround clang parsing problems when includes are missing When an include was missing in a parse run, then the corresponding include directive is removed from the parse using the unsaved-file mechanism, and the document is re-parsed. This is repeated until no more missing includes are found. The corresponding missing-include problems are shown in the problem-reporter anyway, so the user can fix it. M +2 -0 languages/clang/clangparsejob.cpp M +71 -4 languages/clang/duchain/parsesession.cpp M +9 -0 languages/clang/duchain/parsesession.h M +11 -0 languages/clang/duchain/unsavedfile.cpp M +4 -0 languages/clang/duchain/unsavedfile.h M +1 -5 languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/1dffa94f333098bca2830c9da96367156fc9b505
The tentative was reverted as it introduced crashes such as the one shown in Bug 359031. We'll have to revise the patch and resubmit it.
Git commit 140e6c8193711bfbc033cfde69144e0c60279528 by Milian Wolff. Committed on 14/02/2016 at 15:17. Pushed by mwolff into branch '5.0'. Cleanup test case and broken comparison resulting in XPASS. M +18 -11 languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/140e6c8193711bfbc033cfde69144e0c60279528
Proper fix proposed upstream: http://reviews.llvm.org/D17486, also note that this definitely corresponds to https://llvm.org/bugs/show_bug.cgi?id=24268
Fixed upstream now, but we need to patch the code to pass CXTranslationUnit_KeepGoing when available.
Git commit 8af21faaa88682dfb844cc2001a5b8c46eeff576 by Kevin Funk. Committed on 02/03/2016 at 21:25. Pushed by kfunk into branch '5.0'. clang: Make use of CXTranslationUnit_KeepGoing Differential Revision: https://phabricator.kde.org/D1051 M +5 -1 languages/clang/duchain/parsesession.cpp M +11 -0 languages/clang/tests/test_duchain.cpp http://commits.kde.org/kdevelop/8af21faaa88682dfb844cc2001a5b8c46eeff576