Bug 398063

Summary: clang-tidy plugin doesn't build with kdevelop 5.2
Product: [Applications] kdevelop Reporter: Antonio Rojas <arojas>
Component: Analyzer: Clang-TidyAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: kossebau
Priority: NOR    
Version First Reported In: 5.2.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Antonio Rojas 2018-08-30 11:06:50 UTC
Contrary to what is stated in https://frinring.wordpress.com/2018/08/30/improve-your-cpp-code-in-kdevelop-with-clang-tidy/, the clang-tidy plugin doesn't build with kdevelop 5.2

First of all there is an error 

/build/kdevelop-clang.tidy/src/kdev-clang-tidy-0.3.0/src/problemmodel.cpp:78:67: error: variable ‘KDevelop::DocumentRange pathLocation’ has initializer but incomplete type
     KDevelop::DocumentRange pathLocation(KDevelop::DocumentRange::invalid());
                                                                   ^~~~~~~

which can be fixed by adding #include <language/editor/documentrange.h>

After this one gets another error 

/build/kdevelop-clang.tidy/src/kdev-clang-tidy-0.3.0/src/problemmodel.cpp: In member function ‘void ClangTidy::ProblemModel::setMessage(const QString&)’:
/build/kdevelop-clang.tidy/src/kdev-clang-tidy-0.3.0/src/problemmodel.cpp:81:5: error: ‘setPlaceholderText’ was not declared in this scope
     setPlaceholderText(message, pathLocation, i18n("Clang-Tidy"));
     ^~~~~~~~~~~~~~~~~~
Comment 1 Kevin Funk 2018-08-30 11:16:27 UTC
Git commit ed4992ec6dfd530608a8140b35d23f5375e6ad9d by Kevin Funk.
Committed on 30/08/2018 at 11:16.
Pushed by kfunk into branch 'master'.

Add missing include

M  +1    -0    src/problemmodel.cpp

https://commits.kde.org/kdev-clang-tidy/ed4992ec6dfd530608a8140b35d23f5375e6ad9d
Comment 2 Friedrich W. H. Kossebau 2018-08-30 11:19:39 UTC
Indeed, my bad, I managed to screw up my test builds and were using 5.3 where I assumed 5.2 to be building. Working on fixing that, 9.3.1 should be out later today.
Comment 3 Antonio Rojas 2018-08-30 11:23:13 UTC
There's also an '#include <QUrl>' missing in src/problemmodel.h which is needed with Qt 5.11
Comment 4 Friedrich W. H. Kossebau 2018-08-30 11:29:54 UTC
Yes, that as well.

And then some work to ifversion for some kdevplatform API only in 5.3... oh dear, I must have been running the wrong branch for some time :/

Fixing while I comment here :)
Comment 5 Friedrich W. H. Kossebau 2018-08-30 11:46:22 UTC
Git commit 7e56a85ae63bc73cc7470d2db894ec27be57b110 by Friedrich W. H. Kossebau.
Committed on 30/08/2018 at 11:45.
Pushed by kossebau into branch 'master'.

Fix build with KDevPlatform 5.2

M  +6    -0    src/CMakeLists.txt
A  +8    -0    src/config.h.in
M  +6    -0    src/problemmodel.cpp
M  +6    -0    src/problemmodel.h

https://commits.kde.org/kdev-clang-tidy/7e56a85ae63bc73cc7470d2db894ec27be57b110