Paul Fultz II
5d1fdf7958
Fix issue 7904: Handle double nots in isSameExpression ( #1305 )
...
* Fix issue 7904: Handle double nots in isSameExpression
* Skip checking double nots in assignments
* Use ast to check for double not
2018-07-15 11:30:02 +02:00
Daniel Marjamäki
93903d96c4
Refactoring, use Token::isUnaryOp and Token::isBinaryOp
2018-07-13 18:52:03 +02:00
Daniel Marjamäki
03faa25d12
Conditions: Better handling of function calls
2018-07-08 15:58:04 +02:00
Daniel Marjamäki
593f7eee38
Fixed #8624 (Crash below CheckOther::checkDuplicateExpression)
2018-06-14 22:39:26 +02:00
Paul Fultz II
8d53bcfd63
Fix FP when using non-const members and also check return type of function ( #1283 )
2018-06-09 08:05:19 +02:00
PKEuS
4d549553b0
Small optimization in checkmemoryleak.cpp: Allow passing literals to addtoken()
...
Ran AStyle
2018-05-14 10:15:50 +02:00
Paul Fultz II
7ef714b0c6
Fix FP with duplicate assignments by checking if the expression is unique ( #1223 )
...
* Fix FP with duplicate assignments by checking if the expression is unique
* Use array of pointers
* Reorder scope condition
2018-05-13 20:20:55 +02:00
Daniel Marjamäki
ce30a3ca71
astyle formatting
...
[ci skip]
2018-05-11 14:49:31 +02:00
Paul Fultz II
c520735009
Improve checking of size condition against empty to avoid FPs ( #1213 )
...
* Improve checking of size condition against empty to avoid FPs
* Add const and todo for reverse conditions
2018-05-11 10:22:06 +02:00
Paul Fultz II
f5dbfce8ff
Fix false positive with oppositeExpression when using binary op ( #1211 )
...
* Fix false positive with oppositeExpression when using binary op
* Simplify conditional
2018-05-08 20:43:57 +02:00
Daniel Marjamäki
f2bb7397b3
astyle formatting
...
[ci skip]
2018-05-04 14:57:45 +02:00
Paul Fultz II
cac68c6b81
Fix FP when using - as a binary operator ( #1201 )
2018-05-04 07:58:30 +02:00
Daniel Marjamäki
920b553ebf
astyle formatting
...
[ci skip]
2018-05-02 12:58:10 +02:00
Paul Fultz II
f191a3e753
Improve checking of opposite expressions ( #1199 )
...
* Improve checking of opposite expressions
* Fix some formatting
2018-05-02 06:32:33 +02:00
Daniel Marjamäki
121d4ff2ba
isLikelyStreamRead: when using & dont allow astParent
2018-04-22 07:30:45 +02:00
Daniel Marjamäki
4b8769a9f5
astyle formatting
...
[ci skip]
2018-04-18 17:46:31 +02:00
Daniel Marjamäki
7ee636b934
Refactoring: Reuse isLikelyStreamRead in isVariableChanged
2018-04-18 17:46:10 +02:00
Daniel Marjamäki
26e36a1d6b
Fix FP uninitvar when stream bool operator is used
2018-04-18 16:13:24 +02:00
Daniel Marjamäki
219176c11c
Update isLikelyStreamRead ( #8494 )
2018-04-17 20:34:31 +02:00
Daniel Marjamäki
c84628c28a
Fixed #8494 (False positive: serialization class overloads operator)
2018-04-17 14:23:04 +02:00
Dmitry-Me
d9cbaa83d6
Extract common condition
2018-04-08 21:11:44 +03:00
Paul Fultz II
95fc84a26b
Find duplicate expressions assigned to the same variable ( #1129 )
...
* Check for duplicate assignments
* Improve checking of expression
* Add more tests
* Use simple match
* Improve robustness of check
* check for null
* Reduce side effects by checking for side effects
* Improve verbose message
* Reword the error message
2018-04-08 14:43:19 +02:00
Daniel Marjamäki
3ad6c7ebce
Refactoring, use early continue
2018-04-05 08:21:43 +02:00
jrp2014
e65c63e2bb
Refactor lib/astutils.cpp
2018-04-05 08:07:22 +02:00
Paul Fultz II
0c6f184423
Fix false positive for opposite conditions when using different containers ( #1143 )
...
* Fix false positive for opposite conditions when using different containers
* Add additional test
2018-04-05 06:43:13 +02:00
Daniel Marjamäki
e65a5529ad
astyle formatting
...
[ci skip]
2018-03-24 12:30:11 +01:00
Paul
43be20a824
Check more opposite conditions
2018-03-24 07:58:37 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
Daniel Marjamäki
bbeff99cc3
Fixed #6930 (Token: need function that says if the token comes from instantiated template argument)
2018-01-11 09:41:22 +01:00
Daniel Marjamäki
8fe4852b98
Refactoring, reuse and improve isVariableChangedByFunction()
2017-11-18 11:02:52 +01:00
Oleksandr Redko
a8700f5622
Remove redundant parts of conditional expressions ( #988 )
...
All issues were found with PVS-Studio:
V560 A part of conditional expression is always true: tok. astutils.cpp 407
V560 A part of conditional expression is always true: size > 0. checkbufferoverrun.cpp 709
V547 Expression 'secondTrue' is always true. checkcondition.cpp 1013
V547 Expression 'firstTrue' is always true. checkcondition.cpp 1020
V560 A part of conditional expression is always true: !scan. checkio.cpp 1036
V560 A part of conditional expression is always true: scope->function. checknullpointer.cpp 395
V560 A part of conditional expression is always true: tok2. checkstl.cpp 268
V560 A part of conditional expression is always true: par. tokenize.cpp 9440
V547 Expression '!erased' is always true. symboldatabase.cpp 3990
2017-11-03 10:39:57 +01:00
Daniel Marjamäki
5993c40d5b
Improve 'opposite inner condition' check
2017-09-22 14:01:20 +02:00
Daniel Marjamäki
e61222126f
Fixed #8176 (ValueFlow: variable might be changed if it's passed by reference to method)
2017-09-20 22:09:09 +02:00
Daniel Marjamäki
5f4b06c0f4
isVariableChangedByFunctionCall: Fix FN when constructor argument is const reference
2017-09-20 14:03:56 +02:00
Daniel Marjamäki
3e231a9325
Refactoring: Reuse function numberOfArguments() for counting arguments
2017-09-20 13:28:45 +02:00
Daniel Marjamäki
2103726d54
Stop counting arguments properly
2017-09-20 13:00:43 +02:00
Daniel Marjamäki
4318521fc1
Fixed #8187 (isVariableChangedByFunctionCall: Constructor reference argument)
2017-09-20 12:53:25 +02:00
Daniel Marjamäki
56544ac936
Fixed #8211 (Crash on incomplete code in isVariableChanged ())
2017-09-11 13:45:36 +02:00
Daniel Marjamäki
d02d235e5e
Refactoring oppositeInnerCondition checking
2017-09-04 22:54:06 +02:00
Daniel Marjamäki
30f04a5a96
Fixed #8195 (False positive uninitvar (regression) - valueflow misses variable initialization via istringstream >>)
2017-09-02 21:53:51 +02:00
Daniel Marjamäki
0b751dcc1b
Opposite conditions: Better matching when outer condition uses &&
2017-09-01 23:24:15 +02:00
Daniel Marjamäki
3bbcede43b
Fixed #8193 (crash: A = -(-0.2) / (1.0 + B * B) ( daca, lammps))
2017-09-01 22:15:09 +02:00
Daniel Marjamäki
7fad1b9a36
Improved checking for opposite conditions
2017-08-31 22:53:21 +02:00
Daniel Marjamäki
dce942197c
Fixed #8186 (Inner condition always false inside for loop)
2017-08-31 16:00:12 +02:00
Dmitry-Me
d598a1c278
Fix typo causing two expressions being identical
2017-08-30 22:43:54 +03:00
Daniel Marjamäki
59034e17f1
Refactoring, reuse code to skip lambda functions
2017-08-29 22:35:55 +02:00
Daniel Marjamäki
32fe0aba41
Fixed #8037 (ValueFlow: global variable might be modified by function call)
2017-07-09 12:50:17 +02:00
Daniel Marjamäki
0a91ced941
refactoring, use continue in loop instead of nesting
2017-07-09 12:36:33 +02:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
Daniel Marjamäki
8a738eefab
fixed #7998 (uninitialized variable is not found when used with switch/case)
2017-04-23 18:05:14 +02:00