Bug 391812

Summary: False positive for check "function-args-by-value"
Product: [Developer tools] clazy Reporter: Roman <dismine>
Component: generalAssignee: Sergio Martins <smartins>
Status: RESOLVED FIXED    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

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