Commit Graph

107 Commits

Author SHA1 Message Date
Boris Egorov f7c6140e1a checkautovariables: Simplify some conditions 2015-07-05 17:15:13 +02:00
Simon Martin 7481fbb028 Fixed #6506 (Properly detect calls to the deallocating free() function) 2015-06-20 21:00:54 +02:00
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +02:00
Matthias Krüger 42f0955e3f Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
Follow up to eedcb6abcb .
2015-04-10 14:31:19 +02:00
Matthias Krüger eedcb6abcb move setting flags checks out of for loops, make them const. 2015-04-07 07:23:28 +02: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 36841cfa41 Better support for stream operator in CheckAutoVariables::returnReference() (#6423) 2015-01-31 10:12:49 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki a3efa1e180 Fixed #4776 (FP: Assignment of function parameter has no effect outside the function, with goto) 2014-10-21 16:21:33 +02:00
PKEuS 80df3dc642 Disabled several checks and simplifications for C code, if they are C++-only. Do not match arguments for C code, since there can't be overloads. 2014-09-01 18:43:24 +02:00
Dmitry-Me 9199dde560 Move declarations closer to where they're first used 2014-09-01 10:05:59 +04:00
PKEuS ac59485e7e Refactorized CheckAutoVariables::assignFunctionArg():
- Splitted message into style message (assigning non-pointers) and warning message (assigning pointers)
- Support operator++/-- (#4793)
2014-08-04 11:45:24 +02:00
Dmitry-Me c829dff2b9 Use temp variable to omit recomputing the same value. 2014-07-17 10:44:19 +04:00
PKEuS a04036337d Fixed #5860: Don't show returnTempReference for calculations on unknown types 2014-05-24 12:50:04 +02:00
PKEuS 8f79dc3ff8 Cleaned up includes and forward declarations in checkers:
- Removed definitely unnecessary forward declarations (e.g. "class Token"; token.h is already included by check.h, so a definition is unnecessary)
 - Removed unused includes
2014-05-24 12:50:03 +02:00
PKEuS 6635abbe55 Improved check: Complain about returning reference to literals or reference to calculation result (#4317) 2014-05-22 11:39:11 +02:00
Alexander Mai 146bf11aa7 #5793 - False positive: Deallocation of an auto-variable (at reference notation) 2014-05-12 19:53:49 +02:00
Alexander Mai d2ebd718a9 #5691 False positive: autovarInvalidDeallocation - function name 'delete' in C code 2014-05-01 07:32:37 +02:00
PKEuS ea23a0467b Fixed false positive #5732: autovarInvalidDeallocation on pointer to array 2014-04-27 12:18:33 +02:00
Alexander Mai 6a08c27183 Fix segfault in variableIsUsedInScope() - loop variable not check against NULL 2014-03-22 11:14:11 +01:00
Alexander Mai 3f30753122 Fixed #5537 (crash: clang ./lib/Basic/FileManager.cpp , since 354e84e7c8 , /lib/symboldatabase.h:288) 2014-03-09 08:17:24 +01:00
Daniel Marjamäki 569db24756 astyle formatting 2014-03-06 16:21:57 +01:00
Alexander Mai 354e84e7c8 Fixed #2298 (new check: passing stack-address to free()) 2014-03-06 06:32:30 +01:00
Simon Martin 875a3f47e7 Ticket #5478: Only functions and equal operators might return a temporary. 2014-03-02 09:39:10 +01:00
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki 0ef1529ba5 Fixed #5005 (false positive: (warning) Assignment of function parameter has no effect outside the function.) 2013-10-06 16:07:27 +02:00
Daniel Marjamäki 1234ec95f0 Fixed #4998 (False positive: Address of local auto-variable assigned to a function parameter) 2013-10-06 14:23:26 +02:00
Daniel Marjamäki c2a8f6f59a astyle formatting 2013-09-28 09:32:41 +02:00
Simon Martin d67a0add47 Ticket #5024: Don't crash upon invalid code when checking auto variables. 2013-09-28 00:14:12 +02:00
PKEuS 8e84f30244 Refactorization: Make use of Function::retDef where it makes sense 2013-09-03 11:40:43 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Daniel Marjamäki cd5e32446f Fixed #4641 (False positive: Address of local auto-variable assigned to a function parameter) 2013-06-13 16:19:19 +02:00
PKEuS 33cf561d85 Refactorized check for assigning function parameters:
- Fixed false negative: Check is also valid for all non-references, not only for pointers.
- Fixed false negative: Usage before assignment doesn't require bailout
- Fixed false positive #4598 caused by inadequate usage of CheckUninitVar::isVariableUsage
- Made several member functions static
2013-02-18 08:52:49 -08:00
Daniel Marjamki 75e20a996d assign function pointer: Fixed false positive when pointer is used also. Ticket: #2930 2013-02-02 15:26:14 +01:00
Daniel Marjamki 6bb8dd605a assign function parameters: only show warning when --enable=warning or --enable=style is used. Ticket: #2930 2013-02-02 15:08:43 +01:00
Daniel Marjamäki cbbb582fc9 Fixed #2930 (new check: redundant assignment of pointer function parameter) 2013-02-01 19:16:17 +01:00
Robert Reif 94c953931d Simplify checks by caching symbol database Variable pointer in Token 2013-01-31 20:08:48 +01:00
Robert Reif ec1c86c152 Symbol database: more function/variable cleanup. Ticket: #4494 2013-01-31 06:41:18 +01:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Robert Reif 0d4b87c71e SymbolDatabase: Improved find function functionality. Taking arguments into account 2012-10-14 17:30:37 +02:00
Robert Reif 5a7aae31f3 speed up checkautovariables by caching commonly looked up stuff in the symbol database (#4266) 2012-10-12 06:15:46 +02:00
PKEuS 1e5d082251 Moved remaining part of c_str() checking to checkstl.cpp. Fixed false positive #4157. 2012-09-10 15:20:38 +02:00
PKEuS 4fb464982c Fixed crash reported in #4076 2012-08-22 10:17:23 -07:00
PKEuS e05a597066 Fixed false negatives in checkautovariables.cpp:
- Detect returning temporary instances (#4076)
- Added support for returning user defined types
2012-08-22 04:08:32 -07:00
Daniel Marjamäki 9352e124fe Auto variables: Speedup my fix. Use the symbol database instead of Token::findmatch. 2012-07-19 16:42:56 +02:00
Daniel Marjamäki 17c27f51ff Fixed #3791 (False positive: returnTempReference) 2012-07-18 07:22:29 +02:00
PKEuS 247d820027 Fixed #3972: Don't issue auto variable error when the address is assigned to a reference to a non-pointer. 2012-07-13 05:21:45 -07:00
PKEuS f5f63dc4a6 Message refactorization: check64bit.cpp
Added two articles in checkautovariables.cpp as suggested by kimmov
2012-07-08 02:38:58 -07:00