Commit Graph

569 Commits

Author SHA1 Message Date
Daniel Marjamäki a762511067 Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long)) 2017-01-09 22:28:55 +01:00
Daniel Marjamäki b1f7e46491 Fixed #7323 (valueflow: global variables) 2017-01-09 15:53:08 +01:00
Daniel Marjamäki f40bdddbab ValueFlow: Better handling when casting calculation result 2016-12-20 23:09:50 +01:00
Daniel Marjamäki 44ccbdedec ValueFlow: Improved value for cast 2016-12-20 21:37:25 +01:00
Daniel Marjamäki 606bb78297 ValueFlow: Better handling of casts 2016-12-20 19:32:21 +01:00
Daniel Marjamäki e14e86c103 ValueFlow: only set values in conditional code in subfunctions when sure 2016-12-20 11:06:20 +01:00
Daniel Marjamäki 807b653739 ValueFlow: Fix FP in for loops when 2nd expression is 0 2016-12-20 07:54:38 +01:00
Daniel Marjamäki f1ad7368f6 ValueFlow: bool values 2016-12-19 21:21:18 +01:00
Daniel Marjamäki 17aaecbd6b ValueFlow: Improved handling of sizeof 2016-12-18 14:03:48 +01:00
Daniel Marjamäki 4ac5c78e0c Fix wrong iterator usage. Iterator that is erased must be non-const. 2016-12-17 22:20:50 +01:00
Daniel Marjamäki 72e4bc9d88 ValueFlow: skip values that cause false assertion condition 2016-12-17 21:23:14 +01:00
Daniel Marjamäki fd85b493bd astyle formatting
[ci skip]
2016-12-17 18:51:16 +01:00
Frank Zingsheim cb5a5e6a25 Improve Fix #6180 (Access of moved variable still allowed until function is called) 2016-12-17 16:42:46 +01:00
Frank Zingsheim 9a871d33f7 Improve Fix #6180 ("reset" and "clear" clears the move status) 2016-12-17 16:39:30 +01:00
Frank Zingsheim f4ab45f13b Improve Fix #6180 (Do not warn about move if it is part of a reassignment of the variable) 2016-12-17 16:39:30 +01:00
Daniel Marjamäki 31337dda27 ValueFlow: Better handling of && and || in for loop to avoid FP 2016-12-11 21:19:24 +01:00
Frank Zingsheim e0d4720e19 Fix #7829 (false-positive: knownConditionTrueFalse linked to virtual method)
Return values of virtual functions in valueflow are only possible values
since function might be overloaded.
2016-12-11 10:44:05 +01:00
Daniel Marjamäki b098d5fbd6 ValueFlow: We need better handling of casts 2016-12-10 22:09:01 +01:00
PKEuS 2f6350a0d0 Refactorized Library 2016-12-06 14:09:28 +01:00
PKEuS 6e8ac13325 Refactorization:
- Optimized std::string usage
- Replaced list by vector
- Moved iterator into loop head
- Ran AStyle
2016-12-05 17:45:34 +01:00
Daniel Marjamäki 5df8e7f50c Fixed #7596 (ValueFlow: better handling for 'x*(1-x-1)') 2016-12-04 22:39:59 +01:00
Stefan Weil 57b57428c2 Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Matthias Krüger 213589ee68 ValueFlow: don't perform UB when a function returns shifts of/by negative values. Fixes #7814. 2016-11-24 23:23:47 +01:00
Daniel Marjamäki d40f4e4a55 Fixed #7778 (valueFlowAfterAssign: alias) 2016-11-21 17:26:36 +01:00
Frank Zingsheim c8ff96fe8f Fixed #6180 (Usage of variable after std::move or std::forward) 2016-11-20 15:14:49 +01:00
Matthias Krüger b6614d0aa4 valueflow: bail out earlier when encountering divisions by zero. Fixes #7819.
This caused valueflow to actually try to divide by zero, detected by UBSAN.
2016-11-20 14:38:35 +01:00
Daniel Marjamäki 3b57273ef1 Fix Cppcheck warnings 2016-11-14 07:21:10 +01:00
Daniel Marjamäki 1e31c6c01c ValueFlow: Extended handling of float values 2016-11-14 06:42:52 +01:00
Daniel Marjamäki e1e9eacccc ValueFlow: Added float type 2016-11-13 22:59:56 +01:00
Daniel Marjamäki 4732667488 ValueFlow: allow more value types 2016-11-13 22:33:39 +01:00
Daniel Marjamäki 7ebfb10edd Fixed #7806 (ValueFlow: better handling of subfunction with early return) 2016-11-13 18:19:51 +01:00
Daniel Marjamäki ac7b351d1e ValueFlow: Don't calculate x<<64 and x>>64 2016-11-06 20:40:58 +01:00
Daniel Marjamäki dd69d5eabe ValueFlow: Don't calculate result when there is UB 2016-11-06 17:42:01 +01:00
Alexander Mai ee11f0974a #7769 segmentation fault at setTokenValue() on invalid code. 2016-11-06 14:20:58 +01:00
Daniel Marjamäki ece4b1a06f Fix ValueFlow 2016-11-05 09:59:48 +01:00
Daniel Marjamäki 2885a75ea6 ValueFlow: handle ~ in setTokenValue 2016-11-05 09:29:22 +01:00
Frank Zingsheim d4f01583b6 Fixed TODO (check if function parameter is non-const reference etc..) by common function 2016-11-01 14:06:30 +01:00
Robert Reif 4216b26b8c Fixed #7775 (crash at valueFlowSetConstantValue) 2016-10-26 10:36:02 +02:00
Daniel Marjamäki 8a0f3009ff ValueFlow: inner and outer function return values 2016-10-22 17:22:57 +02:00
Daniel Marjamäki 77cd6c194f ValueFlow: Set 'known' property for function return values 2016-10-22 12:24:15 +02:00
Daniel Marjamäki 86a620a3b4 ValueFlow: Better handling of function return value when there are 0 parameters 2016-10-20 16:10:55 +02:00
Daniel Marjamäki efa3aba32a Remove Tokenizer::simplifyNull() 2016-10-18 21:44:02 +02:00
Daniel Marjamäki fae4a4dacf Fixed #7668 (ValueFlow: return value from abs) 2016-10-17 13:05:19 +02:00
Daniel Marjamäki 7fb812f415 Fixed #7752 (ValueFlow: no conditional value, probably because condition is in ternary operator and/or in function call.) 2016-10-16 07:15:28 +02:00
Daniel Marjamäki ad74421526 Fixed #7756 (ValueFlow: fix bug in valueAfterAssign, same variable in lhs and rhs) 2016-10-15 19:09:50 +02:00
Boris Egorov a32f61ae4a Fixed #7139 (ValueFlow: Missed shift operation in for expression) 2016-10-04 13:09:33 +07:00
Daniel Marjamäki 254e5675ff Fixed #7573 (Tokenizer: FP caused by constant folding) 2016-08-28 19:11:05 +02:00
PKEuS e0838ff194 Fixed crash on garbage code (#7699) 2016-08-21 11:06:48 +02:00
Daniel Marjamäki 305609f4fb Fixed #7688 (setTokenValue: crash when there is no 2nd operand for ternary operator) 2016-08-17 18:44:41 +02:00
Daniel Marjamäki 1f98af654a ValueFlow: better handling of ? when condition result is known 2016-08-15 14:19:35 +02:00
Daniel Marjamäki 62362cd06d ValueFlow: improve handling of unary minus 2016-08-14 22:19:06 +02:00
PKEuS 9a6569fde1 Always set ErrorMessage::file0 to ensure that the source file that cppcheck is checking when an error occurs can be identified
Removed unused function and unused includes from preprocessor.h/cpp
2016-07-26 16:28:40 +02:00
Daniel Marjamäki 4f051bf9dd Fixed #7599 (valueFlowAST: handle && and || better) 2016-07-17 21:51:20 +02:00
Robert Reif eca805ba3b ValueFlow: Fixed constant folding of sizeof(enum) and sizeof(enumerator) (#7564) 2016-07-08 20:39:34 +02:00
Robert Reif 66cacde3db Fixed #7513 (value flow of array dimension with enum doesn't always work) 2016-05-26 11:25:50 +02:00
Daniel Marjamäki 636e97c272 ValueType: Improved debug output for nested types 2016-05-08 13:15:20 +02:00
Daniel Marjamäki b94eaeca6a ValueFlow: For convenience, return constant folded value 2016-05-08 11:17:10 +02:00
Daniel Marjamäki b26dd1ccab ValueFlow: Handle enums 2016-05-07 20:18:07 +02:00
PKEuS 23202d9442 Fixed bailoutFunctionPar() for temlate functions (#7396) 2016-05-04 11:38:29 +02:00
Dmitry-Me 12a5f2509b These conditions are mutually exclusive 2016-03-03 18:01:15 +03:00
Dmitry-Me 3bcd0e0535 Reduce variable lifetime 2016-03-02 19:07:20 +03:00
Daniel Marjamäki 1ab5805d98 Fixed #6616 (valueFlowForward: for loop, variable in 3rd expression is changed in loop body) 2016-02-08 10:43:41 +01:00
Alexander Mai cfe9c01bf8 #7257 segmentation fault in valueFlowSwitchVariable (invalid code). Correct SymbolDatabase::validateVariables() so it does not complain about function arguments for function without body 2016-02-03 21:52:02 +01:00
Daniel Marjamäki d5884692df Fixed #7363 (valueflowOppositeCondition - if (size1 > size2) ... else if (size1 < size2) ...) 2016-01-30 22:13:03 +01:00
Matthias Krüger 11be3a9265 fix internal warning: [lib/valueflow.cpp:722]: (warning) Found simple pattern inside Token::Match() call: "if (" 2016-01-30 20:34:33 +01:00
Daniel Marjamäki 30f2bb7796 ValueFlow: set known value for opposite condition in else if (#5503) 2016-01-30 20:03:55 +01:00
Daniel Marjamäki b5986f6ad2 Fixed #7358 (valueflow: value is not known after conditional assignment) 2016-01-27 19:20:00 +01:00
Daniel Marjamäki 462b98afbc Fixed #7310 (ValueFlow: Value of NULL in function call) 2016-01-26 16:53:01 +01:00
Daniel Marjamäki 5c9be4a0df Fixed #7216 (ValueFlow: known value in condition) 2016-01-26 16:10:15 +01:00
Daniel Marjamäki a391bca060 Fixed #7350 (ValueFlow: Result of 'x & 0' is always 0) 2016-01-26 10:07:42 +01:00
Daniel Marjamäki a8416bfb16 Fixed #6000 (ValueFlow: conditional code in for loops) 2016-01-24 13:11:51 +01:00
Daniel Marjamäki 76cdfbf487 Fixed #6330 (valueflow: condition is always false first iteration in dowhile loop) 2016-01-24 08:57:57 +01:00
Daniel Marjamäki 522de81cc7 Refactoring: Move isReturn() to astutils and rename it to isReturnScope() 2016-01-16 18:52:34 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Alexander Mai e9635fd393 #7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration 2015-12-26 23:51:10 +01:00
Daniel Marjamäki 9cb8e9a07e Revert "Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else)"
This reverts commit 04f9b71281.
2015-12-12 16:50:02 +01:00
Daniel Marjamäki 04f9b71281 Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else) 2015-12-12 15:50:33 +01:00
Alexander Mai ba0859e838 #6981 crash in checkvaarg.cpp (with possible fix). Avoid segfault. Add SymbolDatabase::validate() to allow validating smyboldatabase 2015-12-05 20:55:26 +01:00
Daniel Marjamäki 508b06abaa Fixed #6973 (ValueFlow: dont set possible tokvalues in unreachable code) 2015-12-01 07:49:19 +01:00
Daniel Marjamäki 8fb6f33aca ValueFlow: dont set dynamic values in unreachable code (#6973) 2015-11-30 16:15:58 +01:00
Alexander Mai c70b71e353 #5888 fsanitize=undefined: signed integer overflow: 4611686018427387904 * 2 cannot be represented in type 'long long int' in valueflow.cpp 2015-11-27 21:45:08 +01:00
Daniel Marjamäki 0022ce8075 Refactor handling of char constants 2015-11-20 10:10:38 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Daniel Marjamäki 04ecbba361 Fixed #7135 (ValueFlow: Wrong pointer alias set for 'p = &p[x];') 2015-11-15 23:38:23 +01:00
Daniel Marjamäki 595f1e1a27 ValueFlow: set value for char literals 2015-11-12 16:38:58 +01:00
Daniel Marjamäki 34dbc3c00c ValueFlow: Improved handling of a[i] 2015-11-12 16:14:27 +01:00
Daniel Marjamäki b9b0964dab Fixed #7006 (False positive Mismatching assignment and comparison (variable is changed in loop)) 2015-11-11 13:45:28 +01:00
PKEuS 389d30fe44 Fixed crash on garbage code (#7118) 2015-11-09 11:21:07 +01:00
Daniel Marjamäki 37dbebb093 Fixed #7049 (valueflow: value is not known after case) 2015-11-08 14:08:47 +01:00
Daniel Marjamäki f7a7a8a95c Fixed #6934 (False positive returnLocalVariable - assigning local array to function argument) 2015-11-07 15:07:26 +01:00
Aleksandr Pikalev 2d0ecc08c1 Check pointers for NULL before utilizing and do not check it later 2015-11-06 20:24:09 +01:00
Daniel Marjamäki 4b0625c570 Fixed #6239 (Possible null pointer dereference after pointer is modified by a function template) 2015-10-27 12:33:46 +01:00
Daniel Marjamäki 6b9088de3f Fixed #7057 (valueFlowAfterAssign doesn't terminate) 2015-10-19 19:36:46 +02:00
Alexander Mai 8e3e981323 #7050 segmentation fault (invalid code) in isVariableChanged 2015-10-15 21:27:55 +02:00
Daniel Marjamäki 60f8982999 Fixed #7039 (ValueFlow: bitand calculation '16&15') 2015-10-14 10:44:04 +02:00
Frank Zingsheim 3bc21b8138 Fixed #6996 (ValueFlow: known and possible values) 2015-10-04 10:33:43 +02:00
Daniel Marjamäki bd243a4748 Fixed #6903 (ValueFlow: Fix FP in ?:) 2015-09-27 13:29:28 +02:00
Dmitry-Me 85d47e25e4 Move variable declaration to where it's first used 2015-09-16 13:15:07 +03:00
Daniel Marjamäki 8cee96a179 ValueFlow: Refactor 'ProgramMemory' so it can handle token * values also and not just int values. I believe this refactoring is needed before #6973 can be fixed. 2015-09-12 19:49:02 +02:00
Dmitry-Me 70d98c7176 Get rid of set object 2015-09-10 17:59:20 +03:00
amai2012 45bb7d5adb Merge pull request #647 from Dmitry-Me/continueOnRuleMatch
Treat matches as mutually exclusive
2015-08-28 16:00:53 +02:00
Dmitry-Me 962f0ee584 Treat matches as mutually exclusive 2015-08-28 15:27:56 +03:00
Dmitry-Me 81613d958a Replace match call with explicit comparison 2015-08-28 15:16:10 +03:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Dmitry-Me f0aa9e31de Cache and reuse value 2015-08-12 10:57:36 +03:00
Dmitry-Me 50fb9cea66 Reduce variables scope 2015-08-11 17:20:30 +03:00
Daniel Marjamäki 2e78d21480 Fixed #6730 (ValueFlow: inner scope does not return (continue,throw)) 2015-08-11 11:21:03 +02:00
Daniel Marjamäki 07a064aab0 Fixed #6910 (ValueFlow: variable incremented as macro argument is not known) 2015-08-05 14:08:57 +02:00
Daniel Marjamäki 8d3f7e36e9 Fixed #6911 (valueflow: comparison of string and NULL) 2015-08-02 18:12:03 +02:00
Daniel Marjamäki 6790d91fbb Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884. 2015-07-29 19:54:57 +02:00
Daniel Marjamäki fc25ed8c86 Fixed #6879 (valueflow in do-while(++i)) 2015-07-29 11:55:07 +02:00
Daniel Marjamäki bf75ee9aed Fixed #6885 (valueflow ignores assignment of variable via function call) 2015-07-29 10:49:17 +02:00
Daniel Marjamäki a1dfd6cf73 astyle formatting 2015-07-28 12:47:08 +02:00
Daniel Marjamäki e759710198 Fixed #6743 (valueFlowAfterCondition: wrong value when variable is changed in conditional code) 2015-07-28 08:58:05 +02:00
Daniel Marjamäki f449e91d43 made valueFlowSwitchVariable faster when there are many 'case %num%:' 2015-07-27 14:57:02 +02:00
Daniel Marjamäki 5cc744b941 Fixed #6872 (Major performance regression - valueFlowSwitchVariable) 2015-07-27 06:45:06 +02:00
Daniel Marjamäki ed1c6e41d9 Fixed #6876 (valueFlowForward: lambda function) 2015-07-26 19:28:42 +02:00
Daniel Marjamäki 190550f9f9 Fixed #6877 (ValueFlow: valueFlowForward, after goto label the value is not known) 2015-07-26 17:05:21 +02:00
Daniel Marjamäki 4e293d47c5 CheckMemoryLeak: Fix handling of comparisons after simplifyIfNotNull is removed, detected problem with run_more_tests 2015-07-26 11:27:52 +02:00
Daniel Marjamäki afd9f071c0 simplified the code for ValueFlow Known/Possible values 2015-07-25 19:36:29 +02:00
PKEuS ab1113fb16 Fixed crash on garbage code #6859 2015-07-22 13:33:24 +02:00
Daniel Marjamäki ffc707246b ValueFlow: Better handling of Known/Possible values after conditional unknown function call 2015-07-21 17:56:40 +02:00
Daniel Marjamäki 749bb34deb Fixed #6830 (ValueFlow: value of switch-variable inside switch) 2015-07-20 19:45:38 +02:00
Daniel Marjamäki c0880c8d79 ValueFlow: Values that are assigned in switch are possible after switch 2015-07-20 09:36:56 +02:00
Daniel Marjamäki ce7e879460 ValueFlow: isVariableChanged() should return true when variable is changed by passing its address to subfunction 2015-07-18 15:35:39 +02:00
Daniel Marjamäki 5aa0b284dc ValueFlow: Evaluate more calculations when operands have known values 2015-07-18 15:03:57 +02:00
Daniel Marjamäki 25d9ebedd8 ValueFlow: fixed known/possible value of static variable 2015-07-17 20:48:37 +02:00
Daniel Marjamäki f1e410a878 ValueFlow: value that is changed in do while loop must be possible instead of known. 2015-07-17 20:30:34 +02:00
Daniel Marjamäki 69c1a7ecb1 ValueFlow: default argument values are not known, they are possible 2015-07-17 16:05:07 +02:00
Daniel Marjamäki 577ab1c2ac ValueFlow: result of ? is not 'known' 2015-07-17 15:22:24 +02:00
Daniel Marjamäki 61cf224f32 ValueFlow: Make known loop value possible 2015-07-17 10:24:24 +02:00
Daniel Marjamäki 9bdee7fce9 ValueFlow: Refactoring setTokenValue() 2015-07-17 09:46:31 +02:00
Daniel Marjamäki 3d5781743c ValueFlow: Restore handling of not 2015-07-16 21:17:44 +02:00
Daniel Marjamäki 15a8e4d2df Temporarily revert "Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))"
This reverts commit a3fbad50cb.

The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00
Daniel Marjamäki 09efe140fe ValueFlow: Change value to 'Possible' after conditional assignment in inner loop 2015-07-16 21:08:32 +02:00
Daniel Marjamäki 38214b6907 ValueFlow: function arguments only has 'possible' values 2015-07-16 20:49:14 +02:00
Daniel Marjamäki a3fbad50cb Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition)) 2015-07-16 20:17:57 +02:00
Daniel Marjamäki 88491267d6 ValueFlow: Added Value::valueKind that says if value is known or possible 2015-07-16 17:33:16 +02:00
Alexander Mai b604d63dd8 #6726 cppcheck hangs with 100% CPU load (invalidcode) inside Token::astOperand2(). #6840 egmentation fault (invalid code) in Token::astOperand2. Improve stability on invalid code 2015-07-15 15:19:48 +02:00
Daniel Marjamäki 405a1fba11 ValueFlow: set values for false/true 2015-07-14 18:02:26 +02:00
Daniel Marjamäki 7ccd30362c Fixed #6826 (False positive: ValueFlow conditional value used in condition) 2015-07-12 19:35:47 +02:00
Daniel Marjamäki f3b4c1d0db Remove some useless casts, probably added to avoid false positives. 2015-07-04 13:19:21 +02:00
Daniel Marjamäki b8e77c8005 valueflow: fix for ?:. the condition result is not a result of the ?. 2015-07-04 11:17:38 +02:00
Daniel Marjamäki 7e1ddea653 One more fix for #6811 (ValueFlow: result of ?:) 2015-07-02 20:52:04 +02:00
Daniel Marjamäki c751039612 Fixed #6811 (ValueFlow: result of ?:) 2015-07-02 20:11:27 +02:00
Daniel Marjamäki 75b0430ba5 Token::strValue: fixed handling of backslash 2015-06-07 11:25:33 +02:00
Simon Martin 98e6dca4f2 Ticket #6713: Properly detect ternary operator in valueFlowForward. 2015-05-30 20:55:36 +02:00
amai2012 729b240d9c Refactoring (compiler warnings and a typo) 2015-05-25 23:15:59 +02:00
Daniel Marjamäki eb0db322eb Fixed #6560 (ValueFlow: handling ternary operator better in valueFlowSubFunction) 2015-05-24 17:02:00 +02:00
PKEuS 3ce4e68ca6 Refactorization: Make use of do-loops to avoid redundant Token::Match() calls 2015-05-13 13:40:40 +02:00
Daniel Marjamäki ca1f19b6d4 Fixed #6378 (valueFlowForward: decrement not handled) 2015-05-02 17:30:09 +02:00
Dmitry-Me 8a4033e13a Omit unneeded actions 2015-03-24 16:01:59 +03:00
Jakub Melka b7d92a4fc7 Fixed warnings of CppCheck's own code (caused by new check #695) 2015-03-08 18:18:09 +01:00
Daniel Marjamäki d1892786b8 ValueFlow: Improved when using '[' on arrays and strings 2015-02-24 15:57:39 +01:00
Dmitry-Me dfd19233e9 Simplify loop logic 2015-02-09 14:40:17 +03:00
Dmitry-Me 6eacb4957c Simplify ternary operators, use else-if to avoid extra comparison 2015-02-09 11:46:27 +03:00
Dmitry-Me fd0155cacf Reuse already known values 2015-02-09 10:23:36 +03:00
Daniel Marjamäki 8a1b8df1ba ValueFlow: Improved handling of alias values in valueFlowForward 2015-02-08 19:20:05 +01:00
Daniel Marjamäki 1d873de67f Fix testrunner 2015-02-07 19:44:33 +01:00
Daniel Marjamäki 62a5d88eb0 ValueFlow: Improved handling of strings 2015-02-07 18:14:22 +01:00
Matthias Krüger dd70b6e0cd fix internal message: [lib/valueflow.cpp:239]: (warning) Found simple pattern inside Token::Match() call: "} ;" 2015-02-07 12:51:17 +01:00
Daniel Marjamäki 29db3eb848 Fixed #5980 (ValueFlow: pointer cant be 0 below throw in switch) 2015-02-07 10:45:30 +01:00
PKEuS f1714110d0 Fixed crash if double constants are passed as default arguments (#6494) 2015-02-03 22:12:05 +01:00
Dmitry-Me c05e632baf Cache and reuse value 2015-02-03 11:00:40 +03:00
PKEuS 451a277b18 Refactorization: Support function default values in ValueFlow, removed now obsolete CheckNullPointer::nullPointerDefaultArgument().
-> Use valueFlowForward() to parse values passed to functions
-> valueFlowForward(): Set value in first occurrence of a variable in a condition
2015-02-01 15:15:00 +01:00
PKEuS b74b94b1e6 Partially reverted previous commit - std::vetcor instance creation can't be avoided without generating lots of debug messages 2015-02-01 12:33:53 +01:00
PKEuS 58c3fdd063 Fixed crash on garbage code introduced recently, optimized code in valueFlowFunctionReturn. 2015-02-01 12:26:46 +01:00
PKEuS a4cc4c3e3f Refactorization: Use SymbolDatabase scope information in ValueFlow 2015-02-01 12:10:20 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
PKEuS 33f5d27b53 Fixed varId0 message #6443. 2015-01-31 10:33:32 +01:00
Daniel Marjamäki 6a8293a8b7 Library: More strict matching of functions 2015-01-08 19:31:41 +01:00
Daniel Marjamäki 1068e095e7 Fixed cppcheck warning about iterator post increment 2015-01-06 15:16:29 +01:00
Daniel Marjamäki eee9183406 ValueFlow: improved handling of conditional noreturn scope in valueFlowForward 2015-01-06 14:12:35 +01:00
Daniel Marjamäki 1f698ca493 ValueFlow: Fixed valueFlowForward, when condition is false and else-block returns dont set values below the else-code 2015-01-05 16:39:47 +01:00
Daniel Marjamäki c5467766e2 ValueFlow: Fix for valueflow analysis after for loop 2015-01-05 14:00:12 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki 2831bbd420 ValueFlow: better handling of goto to avoid false positives 2015-01-01 14:29:49 +01:00
PKEuS 58f4660c94 Fixed #5223: Bailout in valueFlowForLoop1() for complex conditions
Refactorization: Reuse result instead of calling MathLib::toLongNumber() twice
2014-12-30 19:56:47 +01:00
PKEuS ec826a0e0e Fixed #6022: Support ++%var% in valueFlowForLoop1
Fixed TODO unit test: properly handle loops that are never executed
2014-12-30 18:50:22 +01:00
Daniel Marjamäki 5490fad8c7 Fixed #5840 (False positive (inconclusive): Possible nullpointer dereference - use before for-loop over nested list) 2014-12-14 14:10:42 +01:00
Daniel Marjamäki d8b50e73df Fixed #6002 (Defect: False positive due to pointer address not being associated with variable in for loop) 2014-10-20 15:54:02 +02:00
Daniel Marjamäki 0fd6586fcc Fixed #6219 (valueFlowForward: better multivariable analysis needed to avoid FP) 2014-10-17 06:50:33 +02:00
Daniel Marjamäki 228206f556 Fixed #6067 (ValueFlow: subfunction, condition with && or ||) 2014-10-15 16:34:03 +02:00
Daniel Marjamäki 31d8cac8c9 Fixed #6138 (ValueFlow: entry can't be 0 in loop code 'while (entry = get()) entry->value;') 2014-10-11 17:48:51 +02:00
PKEuS 0cc5b67bf6 Avoid copying std::list object in valueFlowAfterAssign 2014-09-24 13:22:22 +02:00
Daniel Marjamäki ee93d30d94 ValueFlow: improved valueflow for loops that assign variable and then break 2014-09-23 16:06:02 +02:00
Dmitry-Me 6f9730b1d8 Reorder checks, unwrap code 2014-09-16 10:17:06 +04:00
Daniel Marjamäki 29a49d0641 removed some redundant null pointer checks before calling Token::Match 2014-09-14 11:35:04 +02:00
Simon Martin 53b58f0ed9 Refactoring. Use Token::Match instead of hardcoded patterns to increase readability. 2014-09-14 11:26:16 +02:00
Alexander Mai 6b26b6ed31 Fix read access to uninitialized variable 2014-09-06 22:27:13 +02:00
Alexander Mai 5a96413220 #6127 crash on patch(?)-".c" file. Avoid segfault. 2014-09-04 21:28:18 +02:00
Daniel Marjamäki b3e4abd82a Fixed Cppcheck warnings 2014-09-04 18:08:56 +02:00
Daniel Marjamäki 05617d7285 Fixed #6118 (False positive: divide by zero - if condition not evaluated properly) 2014-09-04 17:52:14 +02:00
PKEuS 5d0aa15002 Merge pull request #416 from Dmitry-Me/removeDuplicateChecks
Remove duplicate checks
2014-09-04 07:46:45 +02:00
Alexander Mai 270f59e76a Fix doxygen warning and astyle formatting 2014-09-03 20:38:41 +02:00
Dmitry-Me 68d650e9ac Remove duplicate checks 2014-09-03 14:17:34 +04:00
Alexander Mai a632f68345 #6122 segmentation fault (invalid code) in in valueFlowForLoop2. Simple fix and testcase. 2014-09-02 19:41:50 +02:00
PKEuS 78932094c8 Fixed crash on garbage code #6106 2014-08-31 12:12:03 +02:00
Daniel Marjamäki eeeb8aa0a7 ValueFlow: Fix crash for lambda function 2014-08-27 17:27:34 +02:00
Daniel Marjamäki ae8a20b197 Fixed #6086 (False positive: valueFlow, conditional code returns) 2014-08-27 16:59:18 +02:00
Daniel Marjamäki 23ec9fea8e Fixed #6024 (False positive (nullPointer) using in 1.66) 2014-08-26 18:48:11 +02:00
PKEuS 5e2ea8b6cd Fixed crash #6089 by using information stored in Variable instead of accessing Variable::nameToken 2014-08-26 11:08:21 +02:00
Daniel Marjamäki 789b01aad2 ValueFlow: fixed one more hang in valueFlowForward 2014-08-24 08:50:01 +02:00
PKEuS 69b7f91034 Support :: in some more places 2014-08-19 11:36:32 +02:00
Daniel Marjamäki b2288e5ada Fixed #6022 (Defect: False positive due to bug in determining bounds of for loop 'for (i = 2; i < 1; ++i)') 2014-08-18 16:45:22 +02:00
PKEuS df080ab5c3 Refactorization in valueflow.cpp: Removed redundant loop, rearranged code. 2014-08-18 10:25:30 +02:00
Daniel Marjamäki 5cdbe0f42d ValueFlow: Improved value flow after for loop 2014-08-17 10:40:22 +02:00
Daniel Marjamäki 7ca742c454 Fixed #5062 (ValueFlow: Handle comma operator in abstract interpretation) 2014-08-17 06:42:16 +02:00
Daniel Marjamäki 65f10edcb6 Fixed #5866 (False negative: useless condition or null pointer dereference (null object after while loop, method)) 2014-08-16 18:32:25 +02:00
Daniel Marjamäki e83f08a825 Fixed #6044 (hang: darkplaces / cl_particles.c) 2014-08-14 06:13:42 +02:00
Daniel Marjamäki f0cb6ef33d Change fix for hang so there won't be FP 2014-08-13 05:36:17 +02:00
Daniel Marjamäki bdfe43d82c Fix hang in libdmtx package. found through daca2. 2014-08-13 04:03:17 +02:00
Daniel Marjamäki 970fda9e79 ValueFlow: Fixed nullpointer FP warning in checksizeof 2014-08-11 16:21:20 +02:00
Daniel Marjamäki 8bbbb54f94 Refactoring valueFlowSubFunction 2014-08-06 06:33:06 +02:00
Daniel Marjamäki 9eb28cb8af ValueFlow: Improved analysis of assignments 2014-08-05 08:28:46 +02:00
Daniel Marjamäki a2f776b1b7 Dead pointer: Added checking for dead pointer usage when pointer alias local variable that has gone out of scope. 2014-08-05 06:24:23 +02:00
Daniel Marjamäki d35ce5f0db ValueFlow: Better handling of calculated function arguments in valueFlowSubFunction 2014-08-04 12:31:04 +02:00
Daniel Marjamäki 344016f7ab ValueFlow: Handle string values in valueFlowSubFunction 2014-08-04 12:13:15 +02:00
Daniel Marjamäki 79fc549de0 ValueFlow: start adding valueflow handling of strings and pointer aliases 2014-08-03 20:11:22 +02:00
Daniel Marjamäki f908959196 ValueFlow: improved analysis in for loops to avoid fp 2014-08-01 16:12:57 +02:00
Daniel Marjamäki 688b798b88 ValueFlow: Cleanup variable 2014-08-01 08:59:07 +02:00
Daniel Marjamäki 57c2e928d1 ValueFlow: Simple multivariable control flow analysis to avoid FP when 'control variable' is used 2014-08-01 07:35:15 +02:00
Daniel Marjamäki 25846cf223 ValueFlow: Fix for if/else valueflow analysis 2014-07-30 18:12:33 +02:00
Daniel Marjamäki 15bb447fdc Fixed #5965 (False positive zerodiv - loop iterating over double variable) 2014-07-17 08:44:55 +02:00
Daniel Marjamäki 5bdd197b01 Fixed #5981 (FP: nullPointer on repeated switch) 2014-07-16 09:12:56 +02:00
Daniel Marjamäki c531749d7a ValueFlow: Small cleanups 2014-07-15 10:36:13 +02:00
Daniel Marjamäki 6afe9a4fbe astyle formatting
[ci skip]
2014-07-08 06:44:57 +02:00
amai2012 9b38ae73c1 Attempt to fix 2 Coverity messages.
Replace a few unsigned int by std::size_t
2014-07-07 21:25:30 +02:00
Daniel Marjamäki 987ce5a408 Fixed #5968 (False positive: 'Possible null pointer dereference' when checking null in negated conjuction) 2014-07-07 17:48:58 +02:00
Daniel Marjamäki 26a3bdfe00 ValueFlow: Cleanup code by using SymbolDatabase provided scope info 2014-07-07 16:34:21 +02:00
Daniel Marjamäki b7d7633b97 ValueFlow: Improved analysis after switch 2014-06-30 17:56:42 +02:00
Daniel Marjamäki f1762f9ed6 Fixed #5939 (fp: Possible null pointer dereference, after check against NULL in for loop) 2014-06-30 07:26:48 +02:00
Daniel Marjamäki df799f97c5 valueFlowBefore: better analysis of conditional assignment 2014-06-30 00:02:49 +02:00
Daniel Marjamäki 4f43e4f9aa Fixed #5959 (ValueFlow: return value from subfunction) 2014-06-29 18:04:38 +02:00
Daniel Marjamäki 893996d182 Fixed #5937 (ValueFlow: wrong analysis of calculations with different variable operands) 2014-06-29 10:57:39 +02:00
Daniel Marjamäki 9eaadc81e2 Fixed #5861 (valueFlowSubFunction: fp for float value) 2014-06-28 12:04:20 +02:00
Daniel Marjamäki 5af96c2dd8 Fixed #5947 (valueFlowForward: forward conditions not handled properly) 2014-06-25 16:00:56 +02:00
Daniel Marjamäki c77786a745 valueFlowAfterCondition: wrong analysis for floats 2014-06-25 06:17:44 +02:00
Daniel Marjamäki 54aede9086 Fixed #5941 (ValueFlow: Wrong value in subfunction under ?) 2014-06-24 19:30:46 +02:00
Daniel Marjamäki ae81b09b58 Refactoring: Move isScopeNoReturn implementation to library and reuse it both in ValueFlow and Tokenizer 2014-06-22 19:13:15 +02:00
Daniel Marjamäki f78cbda2db Refactoring: Removed CheckNullPointer::nullPointerByCheckAndDeRef and implemented needed analysis in ValueFlow instead. 2014-06-22 10:02:14 +02:00
Daniel Marjamäki ef81bc363a ValueFlow: analysis in condition. 2014-06-19 17:29:41 +02:00
Daniel Marjamäki dec251ac44 ValueFlow: Refactoring. Use utility function isVariableChanged. 2014-06-19 05:41:19 +02:00
Daniel Marjamäki 84581817f6 ValueFlow: Improved valueFlowForward. RHS in assignment. 2014-06-18 21:07:01 +02:00
Daniel Marjamäki 13761927ff ValueFlow: better analysis in valueFlowAfterCondition of 'if|while ( %var% )' etc 2014-06-18 06:57:48 +02:00
Daniel Marjamäki 9999ce9468 ValueFlow: extend aftercondition analysis below conditional code 2014-06-18 05:51:23 +02:00
Daniel Marjamäki 847bb44bdd ValueFlow: Improved analysis after condition when ! operator is used 2014-06-16 16:39:41 +02:00
Daniel Marjamäki a27ca11b85 Fixed #5916 (ValueFlow: Add a valueFlowAfterCondition() function) 2014-06-15 16:47:01 +02:00
Daniel Marjamäki ad879320e5 ValueFlow: Fixed 'function call => calculation' value flow 2014-06-13 16:34:57 +02:00
PKEuS adf38fcfd0 Further include cleanup 2014-05-24 12:50:04 +02:00