Bug 391812 - False positive for check "function-args-by-value"
Summary: False positive for check "function-args-by-value"
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: 2018-03-13 14:11 UTC by Roman
Modified: 2018-03-17 17:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman 2018-03-13 14:11:22 UTC
I am not sure if this is worth to fix but anyway.

For virtual method

virtual void updateState(const QPaintEngineState &state) = 0;

i declare implementation like this

virtual void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE;

Because class QPaintEngineState is trivial i get warning "function-args-by-value". And i cannot fix declaration because this breaks overload. And also i cannot fix class QPaintEngine because it is part of Qt headers.

Of course i can suppress the warning, but still, if clazy would be little bit smarter and ignore such cases from system headers. Don't know how good the idea is, maybe not really. But it is natural to want reduce any noise if nothing you can do about it.
Comment 1 Sergio Martins 2018-03-17 17:37:10 UTC
Git commit dba14f317183428e64a3d4e6c0559faacafdf6b0 by Sergio Martins.
Committed on 17/03/2018 at 17:14.
Pushed by smartins into branch 'master'.

function-args-by-*: don't warn for overridden methods

As the user often can't change its signature.
If it's a base method then it will warn.

M  +8    -0    src/Utils.h
M  +5    -0    src/checks/level2/function-args-by-ref.cpp
M  +13   -9    src/checks/level2/function-args-by-value.cpp
M  +17   -0    tests/function-args-by-ref/main.cpp
M  +5    -0    tests/function-args-by-ref/main.cpp.expected
M  +17   -0    tests/function-args-by-value/main.cpp
M  +5    -0    tests/function-args-by-value/main.cpp.expected
M  +17   -0    tests/function-args-by-value/main.cpp_fixed.cpp.expected

https://commits.kde.org/clazy/dba14f317183428e64a3d4e6c0559faacafdf6b0