Bug 375274

Summary: #include added at end of file if there is an include there
Product: [Applications] kdevelop Reporter: Nicolás Alvarez <nalvarez>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: wishlist Keywords: junior-jobs
Priority: NOR    
Version First Reported In: 5.1.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:

Description Nicolás Alvarez 2017-01-19 04:21:34 UTC
If I have a foo.cpp file declaring QObject subclasses, I need to add #include "foo.moc". Usually this goes at the end of the .cpp file.

This causes a problem when the assistant offers to add an include file. For example, if I do QWidget foo; the assistant says QWidget is not declared (or only forward-declared) and offers to add #include <QtWidgets/QWidget>. But if I select this solution, it adds #include <QtWidgets/QWidget> at the end of the file, after the .moc include. I would want it to go below all my other includes near the beginning of the file.

I think we need a special case / heuristic here: if the #include ends with ".moc", ignore it for the purpose of looking where to add new #includes.
Comment 1 Kevin Funk 2017-02-21 00:04:09 UTC
Confirmed.
Comment 2 Kevin Funk 2017-02-21 02:06:45 UTC
Git commit b7c4a7479e000751b0d067b359f3c1ad5803c77e by Kevin Funk.
Committed on 21/02/2017 at 02:04.
Pushed by kfunk into branch '5.1'.

clang: Don't insert new include beyond moc include
FIXED-IN: 5.1.0

M  +11   -1    languages/clang/duchain/unknowndeclarationproblem.cpp
M  +30   -1    languages/clang/tests/test_problems.cpp

https://commits.kde.org/kdevelop/b7c4a7479e000751b0d067b359f3c1ad5803c77e
Comment 3 Anton Anikin 2018-08-21 08:44:42 UTC
Git commit 075802a8ff92323f032660b4b989ca2412c2207c by Anton Anikin.
Committed on 21/08/2018 at 08:43.
Pushed by antonanikin into branch '5.3'.

Fix bug 375557 "No indication of cppcheck being run in background"

Summary:
Bug description:
After clicking Analyze -> Cppcheck (Current Project), the Cppcheck tool view opens, but it's empty and does not say that analysis is in progress which is very misleading.

The fix adds notification messages to Problems View:

1) At the start of analysis: "Analysis started..."
   This message will be removed with first problem report.

2) At the end of analysis (if we doesn't have any problems): "Analysis completed, no problems detected."

For both messages we set current analysis path as problem location.

Test Plan: Tested with master branch

Reviewers: #kdevelop, mwolff, kfunk

Reviewed By: #kdevelop, mwolff, kfunk

Subscribers: mwolff, kfunk, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D4816

M  +18   -9    plugins/cppcheck/problemmodel.cpp
M  +3    -0    plugins/cppcheck/problemmodel.h

https://commits.kde.org/kdevelop/075802a8ff92323f032660b4b989ca2412c2207c