Summary: | #include and #<whitespace>include are not handled identically by the parser | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | RJVB <rjvbertin> |
Component: | Language Support: CPP (Clang-based) | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | junior-jobs |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://commits.kde.org/kdevelop/06cbebf36cfa39388430d7043197189b2e54a5d2 | Version Fixed In: | 5.2.2 |
Description
RJVB
2018-05-13 11:43:19 UTC
a bug, patches welcome Any suggestions where to start looking for the source of this bug? I'd search for "#include" but somehow I think that won't be of much help :) (including the quotes actually gives only a single hit, in the astyle plugin). I think those are the spots you should look at: ``` % ag -s ClangUtils::rangeForIncludePathSpec plugins/clang/clangsupport.cpp 102: KTextEditor::Range wordRange = ClangUtils::rangeForIncludePathSpec(line, pair.second); plugins/clang/util/clangutils.cpp 79:KTextEditor::Range ClangUtils::rangeForIncludePathSpec(const QString& line, const KTextEditor::Range& originalRange) plugins/clang/tests/test_clangutils.cpp 273: QCOMPARE(ClangUtils::rangeForIncludePathSpec("#include <vector>"), KTextEditor::Range(0, 10, 0, 16)); 274: QCOMPARE(ClangUtils::rangeForIncludePathSpec("#include <foo\\\".h>"), KTextEditor::Range(0, 10, 0, 17)); 275: QCOMPARE(ClangUtils::rangeForIncludePathSpec("#include \"foo\\\".h\""), KTextEditor::Range(0, 10, 0, 17)); 276: QCOMPARE(ClangUtils::rangeForIncludePathSpec("#include \"foo<>.h\""), KTextEditor::Range(0, 10, 0, 17)); ``` Can it really be so simple to fix? https://phabricator.kde.org/D12903 Can it really be so simple to fix? https://phabricator.kde.org/D12903 Git commit 06cbebf36cfa39388430d7043197189b2e54a5d2 by Kevin Funk, on behalf of René J.V. Bertin. Committed on 16/05/2018 at 07:28. Pushed by kfunk into branch '5.2'. KDevelop : support whitespace between the '#' and 'include' (or 'import') Summary: The C/C++ parser fails to recognise include statements where the hash symbol has whitespace between it and the include/import command. This patch fixes that. FIXED-IN: 5.2.2 Test Plan: Works as expected. Reviewers: #kdevelop, antonanikin, kfunk Reviewed By: #kdevelop, antonanikin, kfunk Subscribers: kfunk, kdevelop-devel Tags: #kdevelop Differential Revision: https://phabricator.kde.org/D12903 M +2 -0 plugins/clang/tests/test_clangutils.cpp M +1 -1 plugins/clang/util/clangutils.cpp https://commits.kde.org/kdevelop/06cbebf36cfa39388430d7043197189b2e54a5d2 |