Bug 377134 - Class method wrongly tagged as Qt signal if defined after class declaration with Q_SIGNALS as last section
Summary: Class method wrongly tagged as Qt signal if defined after class declaration w...
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-03 00:28 UTC by Friedrich W. H. Kossebau
Modified: 2017-03-04 14:24 UTC (History)
1 user (show)

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


Attachments
Diff to tests/incorrect-emit/main.cpp to reproduce the bug (502 bytes, patch)
2017-03-03 00:28 UTC, Friedrich W. H. Kossebau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2017-03-03 00:28:31 UTC
Created attachment 104331 [details]
Diff to tests/incorrect-emit/main.cpp to reproduce the bug

In Okteta I get some wrong "warning: Missing emit keyword on signal call" on calls of some methods defined separately as inline methods right after the class declaration in the header.

I could reduce the problem to the code attached as patch, as a new test case for tests/incorrect-emit.

Seems that somehow the code location comparison in AccessSpecifierManager::qtAccessSpecifierType(...) does not work as intended, but I am too tired to research this more tonight, so just dumping the current state and hoping for the expert to quickly find the mistake :)
Comment 1 Sergio Martins 2017-03-04 01:36:58 UTC
Git commit 9315e636246a9bd365b3d22f66fbebefa5757e0e by Sergio Martins.
Committed on 04/03/2017 at 01:36.
Pushed by smartins into branch '1.1'.

incorrect-emit: Add failing unit-test for bug 377134

A  +20   -0    tests/incorrect-emit/bug377134.cpp     [License: UNKNOWN]  *
A  +0    -0    tests/incorrect-emit/bug377134.cpp.expected
M  +4    -0    tests/incorrect-emit/config.json

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/clazy/9315e636246a9bd365b3d22f66fbebefa5757e0e
Comment 2 Sergio Martins 2017-03-04 12:34:58 UTC
Git commit 53c68bc6888f18409f8e803fb5b9c59f9b1d96c9 by Sergio Martins.
Committed on 04/03/2017 at 12:32.
Pushed by smartins into branch '1.1'.

incorrect-emit: Fix two false positives

When we're comparing a method's source location to check if it's
affected by Q_SIGNAL we must use the first declaration of that method,
and not other declarations which can also be a a definition, and live
outside of the class
Related: bug 377140

M  +4    -0    src/AccessSpecifierManager.cpp
M  +2    -4    tests/incorrect-emit/config.json

https://commits.kde.org/clazy/53c68bc6888f18409f8e803fb5b9c59f9b1d96c9
Comment 3 Sergio Martins 2017-03-04 12:37:10 UTC
please test! should work now
Comment 4 Friedrich W. H. Kossebau 2017-03-04 14:24:14 UTC
Thanks for the quick fix, Sergio!
Can confirm that this fixes both this bug and 377140 for what I have seen them with Okteta builds.

((Darn, and I could have taken some pride here, as I was pretty close to fix this myself then, as I was searching for a method like getCanonicalDecl, but gave up as the llvm lingo did not match my c++ one and then also was already mentally in bed :) ))