Commit Graph

308 Commits

Author SHA1 Message Date
Paul Fultz II f093692551 ValueFlow: Set values in else branch even when the first branch modifies the value (#1309)
* Set values in else branch even when the first branch modifies the value

* Move tests

* Add check for goto

* Remvoe todo

* Also check scope is noreturn

* Use isEscapeScope when variables are changed
2018-07-25 22:59:54 +02:00
Daniel Marjamäki f9a5a114bb astyle formatting
[ci skip]
2018-07-25 07:44:06 +02:00
Paul Fultz II 9895ea5ff2 Fix issue 470: Condition is always true or false on logical operators (#1294)
* Fix issue 470: Condition is always true or false on logical operators

* Dont warn on literals

* Compute logical operators using valueflow

* Fix FP when using literals

* Always warn on subconditions that are always true

* Use percent matches first

* Add test for logical operators

* Check if parent is null
2018-07-23 08:51:59 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Paul Fultz II 0561877182 Fix false positive with negative array index in issue 8536 (#1202)
* Fix FP with negative array index in valueflow

* Remove values when valueflow fails

* Add valueflow test
2018-05-06 08:35:29 +02:00
Daniel Marjamäki c84628c28a Fixed #8494 (False positive: serialization class overloads operator) 2018-04-17 14:23:04 +02:00
Paul Fultz II d8b3fa5c70 Fix #8482: Regression with valueflow (#1159)
* Fix regression with valueflow

* Simplify test case
2018-04-09 16:13:17 +02:00
PKEuS bbfcccf078 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:41:24 +02:00
Paul Fultz II aed84abfd5 Extend valueflow comparison ops (#1153)
* Handle else clause when doing a compare

* Break early

* Fix bug in checking no return else

* Escape quotes

* Add equal sign

* Simplify the logic
2018-04-08 09:24:01 +02:00
Paul Fultz II b871c85b67 Improve valeflow analysis with comparison operators (#1131)
* Improve valeflow analysis with comparison operators

* Use simple match

* Dont add 0 on comparisons

* Check reverse comparisons

* Use nullptr

* Remove duplicate code tests
2018-04-05 06:51:31 +02:00
IOBYTE 5bc039b7da Fix #6367 and #8439 (improve sizeof value flow support) (#1132) 2018-03-23 08:28:12 +01:00
Daniel Marjamäki 7699f6432b Fixed #8288 (valueFlowGlobalVar: compound assignments) 2018-03-18 19:53:33 +01:00
Daniel Marjamäki ec6133aea2 Fixed #8182 (False positive uninitvar - variable initialized in function in ternary expression) 2018-03-16 19:13:48 +01:00
Daniel Marjamäki 7701e4594a ValueFlowBeforeCondition: Fix wrong value in do-while condition when there is a break in the loop body 2018-02-24 22:07:34 +01:00
Daniel Marjamäki e62b9bdc77 Fixed #8348 (ValueFlow: wrong Uninit value with abort() in else-branch) 2018-02-11 22:14:44 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 1b13490ac1 Move code 2018-01-11 14:27:41 +01:00
Daniel Marjamäki 6fd157e93b ValueFlow: Template arguments have 'possible' values 2018-01-11 14:22:27 +01:00
Daniel Marjamäki 9191e6f112 Fixed #8246 (ValueFlow: known value, function pointer argument) 2017-11-17 23:04:54 +01:00
Daniel Marjamäki 4a9984d73b Fixed #8233 (FP uninitvar found in bash:lib/readline/display.c) 2017-11-06 10:28:07 +01:00
Daniel Marjamäki 1d5e3e4f0c Fixed #8247 (False positive knownConditionTrueFalse) 2017-10-20 17:31:58 +02:00
Daniel Marjamäki ad1749738e Fixed #6153 (ValueFlowBeforeCondition: Handle global variables) 2017-10-17 16:55:37 +02:00
Daniel Marjamäki 6d59290858 Fixed #10 (ValueFlow: condition variable has known value in switch case) 2017-10-16 21:51:30 +02:00
Dmitry-Me 2a6f63d995 Resolve C4305 - double constant truncated to float 2017-10-11 23:36:51 +03:00
Daniel Marjamäki 2a6fbe2e3c astyle formatting
[ci skip]
2017-10-05 23:01:42 +02:00
hexcoder 051a18b120 pull request for ticket 8180 (better diagnostic output for bailouts) (#964)
* sync build instructions from readme.txt

* refactored the patch from ticket 8180. Moved logic from macros to the bailoutInternal function

* adapt to new bailout message format

* adapt to new bailout message format

* adapt to new bailout message format

* compile fix for Microsoft platform

* remove directory part from file locations in bailout message (normalize)

* remove directory part from valueflow message filter

* adapt tests to file format without directory part

* adapt tests to file format without directory part

* new line number agnostic assert_equals methods

* new line number agnostic assert_equals methods

* adapt to new method assertEqualsWithoutLineNumbers()

* adapt to new method assertEqualsWithoutLineNumbers()

* Bugfix: do not replace line number with spaces, remove it

* review changes: const char * -> std::string, size_t -> int, std::to_string() -> MathLib::toString()

* set #line at the beginning to guard against insertions from match compiler

* Bugfix: counting lines can be difficult :-) #line 1 -> #line 2

* added method stripDirectoryPart()

* added method stripDirectoryPart()

* used new method Path::stripDirectoryPart()

* new dependency path.h in lib/valueFlow.cpp

* code cleanup, removing redundant temporary objects and casts
2017-10-05 23:03:13 +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 4318521fc1 Fixed #8187 (isVariableChangedByFunctionCall: Constructor reference argument) 2017-09-20 12:53:25 +02:00
Daniel Marjamäki 1dbcba4dd6 Fixed #8221 (ValueFlow: value for static variable that is not written) 2017-09-15 15:58:19 +02:00
Daniel Marjamäki ef1f3fbee6 Fixed #8173 (ValueFlow: use AST when setting values in assignment RHS ((n=42) && n=='A')) 2017-09-14 22:49:47 +02:00
Daniel Marjamäki a02fd54a69 ValueFlow: Avoid FPs for aliased variables 2017-09-03 23:24:55 +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 9c99bc43c2 ValueFlow: Skip wrong handling of lambda functions. TODO: handle lambda functions properly. 2017-08-28 22:39:12 +02:00
Daniel Marjamäki 02a1b7cd2d Fixed #7965 (valueFlowForward: Improved handling of correlated variables) 2017-08-27 19:50:44 +02:00
Daniel Marjamäki 529b255e99 ValueFlow: Better errorpath for increment/decrement 2017-08-25 23:07:26 +02:00
Daniel Marjamäki b1b8e5270a ValueFlow: Better errorpath for increment/decrement 2017-08-25 22:15:52 +02:00
Daniel Marjamäki 50636f75ba ValueFlow: Improved error path for compound assignments 2017-08-24 22:02:49 +02:00
Daniel Marjamäki f10634c021 ValueFlow: Dont try to evaluate '/=0;' 2017-08-23 17:53:05 +02:00
Daniel Marjamäki 167cfb1ac5 valueFlowForward: improve handling of compound assignments 2017-08-23 11:13:47 +02:00
Daniel Marjamäki 3abb62a6d1 Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);) 2017-08-20 19:47:26 +02:00
Daniel Marjamäki e58344c2c9 Fixed compiler warning 2017-07-22 16:23:33 +02:00
Daniel Marjamäki bf5040e3d6 Fixed #7701 (ValueFlow: handle 64-bit unsigned values ) 2017-07-22 12:19:46 +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 bce0776417 Fixed #7795 (ValueFlow: Value is not known after conditional increment ) 2017-06-01 15:16:07 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 82a372a380 Try to clarify ErrorPath texts 2017-05-20 08:47:35 +02:00
Daniel Marjamäki f92b16706c ValueFlow: Add ErrorPath info after for loop 2017-05-19 16:32:58 +02:00
Daniel Marjamäki 2bb54fef69 ValueFlow: Test ErrorPath handling 2017-05-19 14:34:59 +02:00
Daniel Marjamäki 040d2f0012 Use simplecpp lexer in test cases 2017-05-18 21:52:31 +02:00
Daniel Marjamäki 980ca39fe2 valueFlowForward: better handling of sizeof() in rhs in assignments 2017-04-29 08:25:55 +02:00