Bug 323537 - semantic highlighting gets confused with function macro arguments
Summary: semantic highlighting gets confused with function macro arguments
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.5.1
Platform: Kubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-15 08:38 UTC by Santeri Piippo
Modified: 2016-01-24 12:16 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Santeri Piippo 2013-08-15 08:38:12 UTC
If you have a function macro whose argument expands to an instance of a class after appending some suffix to it (in this example, "Class"), the semantic highlighter will try colorize the arguments of the function macro (which is awesome) but seems to apply the coloring to wrong lengths.

In the below case there is
CLASS_INSTANCE (int, arghinator);
and it gets colored up as if it were
CLASS_INSTANCE (intClasshinator);
since intClass is the type and the highlighter seems to colorize it in its full length

Reproducible: Always

Steps to Reproduce:
1. copy/paste the code below and save it to a .cpp file so KDevelop starts highlighting it as C++
2. observe the semantic highlighting
Actual Results:  
https://dl.dropboxusercontent.com/u/66055976/kde/kdev-macro-highlighting-1.png

Expected Results:  
https://dl.dropboxusercontent.com/u/66055976/kde/kdev-macro-highlighting-2.png
(manipulated image)

class intClass {};
class boolClass {};

#define CLASS_INSTANCE(T, NAME) T##Class NAME

CLASS_INSTANCE (int, arghinator);
CLASS_INSTANCE (bool, blarghinator);
Comment 1 Alexander Potashev 2013-12-15 01:35:28 UTC
I comfirm this in KDevelop 4.5.1 (Gentoo, KDE SC 4.11.2).
Comment 2 Andrey Cygankov 2016-01-23 23:36:07 UTC
I tried to reproduce the bug in KDevelop 5 - semantic highlighter displayed normal.
http://i.imgur.com/oeeygdY.png
Probably it is necessary to close.
Comment 3 Milian Wolff 2016-01-24 12:16:14 UTC
Hello!

We are working on a new clang-based C/C++ language plugin for KDevelop 5 which
supersedes the old C++ plugin in KDevelop 4. See e.g.:
https://www.kdevelop.org/news/first-beta-release-kdevelop-500-available

Due to a lack of manpower, we cannot fix bugs in the old C++ plugin. We rather
want to supply a good Clang based C++ experience for KDevelop 5 than wasting
our time on the legacy C++ support for KDevelop 4.

With the new clang-based C/C++ language plugin, the bug presented here does not
occur. In my testing. For these reasons, I'll close this bug. Please stay tuned
for KDevelop 5.

If you think this bug is applicable to Clang/KDevelop 5, please reopen the
report and add new information on how to reproduce the bug there.

Sorry for the inconvenience, I hope you understand the reasoning above.

Cheers