Commit Graph

394 Commits

Author SHA1 Message Date
Robert Reif bbc1747919 Fixed #3702 (False negative: fail to detect constructor implementation with slightly different (irrelevant) signatures) 2012-11-26 16:34:44 +01:00
Robert Reif 8e14d7682c Symbol database: fix some function prototype bugs that were found during check conversions. Ticket: #4266 2012-10-30 15:48:06 +01:00
Daniel Marjamäki b591097c87 Revert "Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)"
This reverts commit 1ee980184e.
2012-10-16 19:12:27 +02:00
Robert Reif 1ee980184e Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails) 2012-10-16 06:11:28 +02:00
Robert Reif cf7996e299 SymbolDatabase: Improved find function functionality. Taking arguments into account 2012-10-14 17:34:09 +02:00
Robert Reif 0d4b87c71e SymbolDatabase: Improved find function functionality. Taking arguments into account 2012-10-14 17:30:37 +02:00
Robert Reif 2a2366b258 Fixed #4226 (False positive: Uninitialized variable (problem with namespace ::rtl)) 2012-10-14 17:25:29 +02:00
Robert Reif bbfd676b4e speed up checks by caching commonly looked up stuff in the symbol database 2012-10-10 20:42:07 +02:00
Robert Reif 8ccbde117a Fixed #4261 (CheckOther::checkComparisonOfFuncReturningBool using wrong function scope test) 2012-10-08 16:15:07 +02:00
PKEuS 929f16d892 Fixed hang on garbage code (#4193) 2012-09-14 15:32:35 +02:00
PKEuS 22a8e3f4e6 Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better. 2012-09-11 18:03:47 +02:00
PKEuS e9f13e1547 Fixed false positive #4163 2012-09-10 16:14:24 +02:00
PKEuS c2d4afc525 Support default arguments in symboldatabase for arguments without name (#4055) 2012-09-06 20:50:46 +02:00
PKEuS 20f989b6c4 Skip code in brackets in default argument declaration (fixes #4057) 2012-09-06 20:02:53 +02:00
Daniel Marjamäki d7e521845b SymbolDatabase: Made function static after self-check suggestion 2012-09-01 10:46:09 +02:00
PKEuS 00f6c635b8 Detect functions returning a template type in SymbolDatabase
Fixed comment
2012-08-22 03:37:50 -07:00
PKEuS 35d94c26d5 Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness

The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS 4f68923add Fixed inverted id and msg of debug messages from symboldatabase 2012-08-12 02:11:54 -07:00
PKEuS 68e19b33ff Fixed parsing of C++11 initializatation in initializer list (#3957) 2012-07-10 06:15:11 -07:00
Edoardo Prezioso fae40c4782 Change every C version of 'size_t' to C++ 'std::size_t'. 2012-07-09 13:30:18 +02:00
Daniel Marjamäki 8aba801360 Fixed #3800 (False negative: Self-assignement of variable declared as 'extern') 2012-06-22 11:23:50 +02:00
Daniel Marjamäki edea4ef131 Refactoring: Renamed CheckNullPointer::isPointer to Token::isUpperCaseName 2012-06-21 19:00:53 +02:00
PKEuS c463d97386 Refactorization:
- Implemented consistent behaviour of Variable::typeStartToken/typeEndToken: Skip const and static on all variables.
- Simplified patterns containing "static|" or "const|" when matching typeStartToken.
2012-06-08 09:05:02 -07:00
Daniel Marjamäki 3c103e520b Fixed #3854 (false positive: (style) Variable '_S_c_name' is assigned a value that is never used) 2012-06-05 06:37:55 +02:00
PKEuS e2bab4b6a3 Implemented Function::nestedIn to be able to identify the scope the function belongs to, even if Function::functionScope.functionOf is not available.
Refactorized usage of SymbolDatabase in checkOther:
- Don't copy Function instances in checkExpressionRange
- Simplifications by more accurate usage of information in database
2012-05-24 08:40:43 -07:00
PKEuS dc64ac2918 Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart. 2012-05-22 12:58:46 -07:00
PKEuS 26f5f08614 Initialize Function::start when the function is implemented, not when its defined. (Fixes #3826) 2012-05-22 12:30:10 -07:00
PKEuS e8dfe2407a Fixed crash in Variable::evaluate (#3825) 2012-05-22 01:29:33 -07:00
PKEuS 77927583f4 Fixed two compiler warnings spotted by edward-san (one of them was a real bug) 2012-05-17 08:29:32 -07:00
PKEuS 4bb2a1b27b Made some functions static or const according to cppcheck results 2012-05-17 01:33:24 -07:00
PKEuS 132a95b5f2 Fixed bug in symboldatabase: Don't ignore const or static on variables declared that are declared with both keywords. (Fixes #3805) 2012-05-15 12:03:43 -07:00
PKEuS 1dee3b04b9 Bugfixes in SymbolDatabase:
- Constant pointers are now detected as variable declarations
- Probably fixed #3802
2012-05-14 12:47:02 -07:00
Edoardo Prezioso eacf74be8d Changed the order of some structures in order to improve, even if for a bit, their padding. 2012-05-14 20:49:03 +02:00
PKEuS 0452b03f53 Refactorizations in SymbolDatabase:
- Moved complete evaluation of variables type into one function executed when the variable is constructed
- Moved SymbolDatabase::ArrayDimensions to Variable::ArrayDimensions
2012-05-11 17:56:47 +02:00
PKEuS 6ef92c4fd7 Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp
Fixed test failure introduced in f105bf75a6
2012-05-06 04:01:56 -07:00
PKEuS 1a5fbd61d2 Splitted class TokenList from Tokenizer 2012-05-05 09:33:26 -07:00
PKEuS aec57db9b2 Fixed #3778: Added missing function Function::getArgumentVar 2012-05-03 13:29:41 +02:00
PKEuS a0d92f5ed9 Refactorizations in SymbolDatabase:
- Skip struct keywords in argument list so that Variables declared like "Struct Foo bar" get a type
- Remvoved redundant argument from Function::addArguments
- Set Function::functionScope for global functions
- Replaced some indendation counters by Token::findClosingBracket
2012-04-27 21:51:13 +02:00
PKEuS ebf89aa229 Fixed #3725: Associate functions with correct parent scope when definition doesn't directly follow declaration. 2012-04-25 20:52:59 +02:00
PKEuS cb064dc20e Implemented generic mechanism for '<'-'>' "linkage" before link() works (Taken from Scope::findClosingBracket, but C++11 right angle bracket support added): Token::findClosingBracket
-> Replaced several indendation-counting mechanisms in tokenize.cpp

Fixed build failure in checkclass.cpp
2012-04-18 16:02:03 +02:00
PKEuS f6fd44910a Refactorizations in SymbolDatabase:
- Replaced Scope::access by a locally stored std::map, because its a temporary status variable that is only necessary when creating the symboldatabase
- Moved SymbolDatabase::argsMatch to Function::argsMatch, because its function specific
- Improved Scope::findClosingBracket: Improved reliability, made it static and faster
2012-04-18 13:00:34 +02:00
PKEuS c6f6194008 Added Function::isImplicitlyVirtual to symboldatabase.cpp
Made SymbolDatabase::argsMatch static because its possible and necessary for Function::isImplicitlyVirtual
2012-04-17 19:50:44 +02:00
Daniel Marjamäki 26a9a1b571 Fixed #3661 (False positive: unusedPrivateFunction) 2012-04-09 11:19:19 +02:00
PKEuS e6bcab7c35 Fixed #3360: "type const* var;" is now recognized as variable declaration. 2012-03-24 15:10:06 +01:00
PKEuS e938235385 Store functions which are declared but not implemented in the function list of the containing scope -> Fixed #3679
Refactorizations:
- Simplified some code
- Improved condition in findVariableType to reduce unnecessary comparisions of empty strings.
2012-03-23 17:59:51 +01:00
PKEuS 1747813a8b Added check for invalid pointer casts (#1255)
Detect sign extension problems when variable is a reference (#3637)
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
PKEuS 9a5f66030c Improved unused private function check:
- Fixed #3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
2012-02-24 20:45:56 +01:00
PKEuS 42f418db54 - Improved nullpointer check: Fixed #1171
- Improved accuracy of function analysis in symboldatabase
- Code cleanups
2012-02-11 12:26:48 +01:00
Edoardo Prezioso bc034095f1 Fixed ticket #3543 (segmentation fault of cppcheck). 2012-01-31 19:34:55 +01:00
Robert Reif 42afd2d63a fix #3561 (SymbolDatabase: throw foo; creates a variable with type throw) 2012-01-27 19:24:01 -05:00
PKEuS 6906001366 Added support for references to symboldatabase 2012-01-26 17:04:25 +01:00
Robert Reif 6b0aff487f symbol database: add preliminary support for throw/catch block scopes. Just like the rest of cppcheck, ... is not handled properly for variables. Deep namespaces are also not handled properly yet. This is not an issue because this new capability is not used by any checks so it should be harmless. 2012-01-25 22:05:29 -05:00
Robert Reif b6afa8a025 symbol database: add missing variable flag debug printing 2012-01-24 20:45:38 -05:00
Robert Reif e39b70c1be symbol database: add missing endl in debug dump 2012-01-22 22:32:53 -05:00
Daniel Marjamäki f81557da50 Fixed #3508 (Symbol database: mixing up constructors and destructors) 2012-01-22 19:48:36 +01:00
PKEuS 96ae010e48 - Correctly set Scope::function variable in symboldatabase
- Refactorizations
- Fixed some cppcheck warnings
2012-01-21 10:08:09 +01:00
Daniel Marjamäki 6a63104743 Fixed #3320 (False positive: Member variable is not initialized in the constructor (namespaces).) 2012-01-07 09:28:26 +01:00
Daniel Marjamäki c5f62c19d6 astyle formatting 2012-01-05 18:24:27 +01:00
Daniel Marjamäki 56a5e08f6b Use symbol database dump code written by Robert Reif. The symbol database is dumped if --debug is used. 2012-01-05 18:22:54 +01:00
Edoardo Prezioso 94a2287370 Revert 'using' changes as it was until some time ago. 2012-01-02 19:27:32 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Edoardo Prezioso b9c796d9f8 - Re-elaborate 'using' keyword skipping in Tokenizer::setVarId and
Scope::getVariableList;
- Improve setVarId: add possible declaration: 'A f(&x);' and change from:
'if (...){}else{ continue; };' to: 'if (!...) continue;';
- Little refactoring of 'Tokenizer::removeTokens()'.
2011-12-31 21:36:19 +01:00
Reijo Tomperi 0e1fb5f75b astyle fix 2011-12-30 21:01:33 +02:00
Edoardo Prezioso 0d3bf5340d Improve varId and getVariableList filter, related to previous commit. 2011-12-30 18:13:42 +01:00
Edoardo Prezioso 8c68b811f3 Fix debug message "Scope::checkVariable found variable '%var%' with varid 0." in C# code with 'using %var%;'. 2011-12-30 13:01:09 +01:00
Daniel Marjamäki a4dcf8feea Fixed #3435 (False positive: (warning) Member variable 'A::m_Vec' is not initialized in the constructor.) 2011-12-25 11:05:06 +01:00
PKEuS dca03c3ce2 Remove unnecessary includes
Also add a unit test related to #3427
Also improve the description text in checkclass and remove unused variable.
2011-12-23 23:31:48 +02:00
Marek Zmysłowski 4b4f201b79 Fixed #3437 (segmentation fault of cppcheck) 2011-12-22 07:28:28 +01:00
PKEuS f306246c7f Improved support for references and pointers in SymbolDatabase
Replaced several isPointer functions by Variable::isPointer function
Refactorizations & Make use of symbolDatabase more often
2011-12-17 19:04:03 +01:00
Edoardo Prezioso 4cad5d4df4 Workaround fixes to shut up some cppcheck '--inconclusive' whinings. 2011-12-13 00:24:34 +01:00
Edoardo Prezioso 42e369a4b4 Change every 'tokAt(..)->link()' to 'linkAt(..)'. 2011-11-20 14:24:27 +01:00
Edoardo Prezioso 2c64d299ca Change every 'tokAt(...)->str()' to 'strAt(...)'. 2011-11-13 13:10:59 +01:00
Edoardo Prezioso b28a44dc3b Change: 'next()->next()'->'tokAt(2)', 'previous()->previous()'->'tokAt(-2)'. 2011-11-12 22:33:03 +01:00
Thomas Jarosch 54adb910ec Use Token::simpleMatch instead of Token::Match for simple patterns 2011-10-27 15:59:22 +02:00
Edoardo Prezioso 12f6ce46f8 Add more warnings and fix the ones reported by them. 2011-10-22 15:05:43 +02:00
Benjamin Goose 3f25bd9530 Qualify fill_n properly.
Relying on ADL isn't a good idea as it's not always well implemented.
2011-10-20 09:02:20 +02:00
Daniel Marjamäki 1ec32e27db Borland: Fixed compiler errors 2011-10-16 07:52:54 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Robert Reif a1a839fadc fix tokenizer and symbol database to not mistake goto statement for variable declaration 2011-10-07 08:11:48 -04:00
Robert Reif 092ba0b1de fix symbol database bug where function variable type of a nested class was not found 2011-09-28 22:05:26 -04:00
Robert Reif 40009d091d add multi-dimension array support to second checkScope and use it for member arrays 2011-09-11 20:42:57 -04:00
Robert Reif 7cb5c97e7d move member variable lookup code from a check to the symbol database so it can be reused by other checks 2011-09-03 12:22:13 -04:00
Robert Reif d749e28dc0 another partial fix for #3063 (false negative: multi dimensional arrays not well supported) 2011-09-02 21:07:29 -04:00
Robert Reif 7775934492 really fix multi-dimensional arrays with undefined size 2011-08-28 13:32:42 -04:00
Robert Reif cf6d04de74 fix #3044 (Symbol database: handle multidim array with unknown dimension 'char a[][4]') 2011-08-28 11:40:55 -04:00
Robert Reif dfe89f395a fix #3049 (False Positive - Technically the member function 'VideoOutputNull::SetupDeinterlace' can be const.) 2011-08-25 19:13:53 -04:00
Robert Reif 6f3131da8c fix a serious symbol database bug where parts of a function could be skipped 2011-08-23 20:12:29 -04:00
Robert Reif 88019658b4 fix #3013 (segmentation fault of cppcheck ( struct x : virtual y )) 2011-08-16 19:16:58 -04:00
Robert Reif f7b9d4d726 fix #2991 (segmentation fault of cppcheck ( ::y(){x} )) 2011-08-11 17:57:54 -04:00
Robert Reif 54141f2e7f fix #2943 (Symbol database: Wrong parsing of std::vector as base class.) 2011-07-27 11:23:22 -04:00
Robert Reif 5e1fd81ea7 add support for local variables with constructors to the symbol database 2011-07-23 15:12:30 -04:00
Robert Reif d447e61b09 fix #2884 (Integer overflow warning in 64-bit build) 2011-07-01 16:59:17 -04:00
Robert Reif c99a15516d fix symbol database derived template class support 2011-06-29 19:52:07 -04:00
Robert Reif 18369ea6ac add global namespace derived class support 2011-06-29 19:43:39 -04:00
Robert Reif 272eb445fb fix #2865 (segmentation fault of cppcheck ( char a[1] )) 2011-06-27 07:31:10 -04:00
Robert Reif 93495613dd replace some pattern matching with variable lookup in checkGlobalAndLocalVariable 2011-06-24 08:02:41 -04:00
Robert Reif 4656eba34c set symbol database array variable dimensions specified by a variable to the maximum size that variable can hold 2011-06-23 22:35:15 -04:00
Robert Reif 0c46f44e3d add array information to symbol database 2011-06-22 22:41:11 -04:00
Robert Reif e8eb20c6ef fix debug warning for function parameters with template with varid of 0 2011-04-28 20:53:31 -04:00
Robert Reif 6750c7b492 don't debug warn about class function definitions without body having missing varid on function parameters 2011-04-22 21:41:55 -04:00
Greg Hewgill 3fc1db51d1 Change symbol database such that the typestart token skips over type modifiers (const/static/mutable).
This fixes checking for the case of a memset() on a static variable.
2011-04-23 01:13:23 +12:00
Daniel Marjamäki 58dbbb0cab Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError. 2011-04-14 18:02:01 +02:00
Robert Reif 64fa7bf8d4 symbol database: add support for anonymous struct and union 2011-03-31 20:54:23 -04:00
Robert Reif faaff942d2 symbol database: improve function argument count and default argument count 2011-03-30 21:59:43 -04:00
Robert Reif d17a204096 symbol database: get function argument count using argument list size rather than counting commas 2011-03-30 21:14:24 -04:00
Robert Reif ce934f03a4 symbol database: handle default values for function arguments properly 2011-03-29 23:16:13 -04:00
Robert Reif 9612573d8e add support for array of unnamed struct and union to symbol database 2011-03-29 19:48:12 -04:00
Robert Reif b31da161a7 more support for anonymous struct to symbol database 2011-03-29 07:47:39 -04:00
Robert Reif 678486f0db add support for anonymous struct to symbol database 2011-03-29 07:08:59 -04:00
Robert Reif 31f8ff723b skip nested anonymous unions when searching for variables in symbol database 2011-03-27 18:37:31 -04:00
Robert Reif 20853fe273 add anonymous union support to the symbol database 2011-03-27 13:48:41 -04:00
Robert Reif d643918761 symbol database: add a link from a Function to its Function Scope namd make function parameters belong to Function Scope 2011-03-24 22:08:18 -04:00
Robert Reif 15fc071514 add virtual base class support to symbol database 2011-03-21 20:03:41 -04:00
Robert Reif 41d80b5c8d fix #2664 (False negative: function can be const (using type from another namespace)) 2011-03-20 12:53:37 -04:00
Robert Reif 1de35c168d fix #2657 (segmentation fault of cppcheck ( gcc-testsuite: return f(){} )) 2011-03-17 20:10:56 -04:00
Robert Reif 47531dd99c fix #2637 (segmentation fault of cppcheck ( {} const const )) 2011-03-15 22:33:14 -04:00
Robert Reif 3babf6a9eb look for function prototypes but don't save them in the symbol database yet 2011-03-13 22:59:25 -04:00
Robert Reif 47a90851f1 save pointer to Function info in function scope in symboldatabase 2011-03-13 21:18:49 -04:00
Robert Reif 836fadcb6a save location of using directive (not used yet) 2011-03-13 21:01:33 -04:00
Robert Reif 51662eeedd save start parentheses of global functions 2011-03-12 20:35:52 -05:00
Robert Reif 79f0fe7d1c refactor symbol database and checks to use list of Scope rather than list of Scope pointers 2011-03-10 19:43:29 -05:00
Robert Reif c457179ce6 fix null pointer dereference found by clang++ --analyze 2011-03-08 20:14:46 -05:00
Daniel Marjamäki e26a7819d3 Symbol database: variable fix. ticket: #2629 2011-03-06 21:21:42 +01:00
Robert Reif c9b2ab3c26 add debug message for function argument missing varid 2011-03-02 21:08:27 -05:00
Robert Reif 3db0e7ef8f fix symbol database bug where delete can be considered a variable declaration 2011-02-27 10:35:59 -05:00
Robert Reif 962183f964 add an array flag to symbol database Variable class 2011-02-27 10:21:14 -05:00
Robert Reif 0872f1291e fix a symbol database bug where a return statement could be considered a variable declaration 2011-02-27 10:13:40 -05:00
Daniel Marjamäki e3f779a41c Symbol database: Fixed debug warnings for true/false. true/false doesn't have varId. 2011-02-26 23:58:02 -08:00
Robert Reif 2b03bfaf38 fix a bug in symbol database while scope processing 2011-02-26 23:00:06 -05:00
Robert Reif 8152cbbd1b add a varId to Variable lookup table and fill it in with all variables 2011-02-26 15:57:16 -05:00
Robert Reif 7638a4554e add local scopes to the symbol database 2011-02-26 15:53:57 -05:00
Robert Reif eda25f6502 add a list of function arguments to symbol database Function class 2011-02-26 15:51:12 -05:00
Robert Reif abbd37d380 extend symbol database Variable with more information 2011-02-26 09:08:59 -05:00
Robert Reif c283bc414d fix symboldatabase global variable detection 2011-02-25 07:17:55 -05:00
Robert Reif 5f84272a52 fix segfault: #2591 (cppcheck hangs with 100% cpu load ( class A : )) 2011-02-21 14:25:35 -05:00
Robert Reif 597aea9f15 save start of function '{' and start of variable declaration in symbol database so checks don't have to find them 2011-02-20 08:25:42 -05:00
Robert Reif e6eb160395 fix [B#2589 (segmentation fault of cppcheck (struct B : A)) 2011-02-19 14:38:00 -05:00
Robert Reif f9b1505115 fix Scope::findInNestedListRecursive to check all children 2011-02-19 13:40:02 -05:00
Robert Reif 218464df89 fix #2580 (false postive with Unused private function) 2011-02-14 19:50:13 -05:00
Robert Reif 2aefa5deb5 fix #2577 (segmentation fault of cppcheck) 2011-02-12 15:35:48 -05:00
Robert Reif 2900d44ff0 #2560 (False positive: The class 'Altren' does not have a constructor, because base class is in namespace.) 2011-02-10 07:37:55 -05:00
Robert Reif c592ccd35d Fixed #2547 (segmentation fault of cppcheck) 2011-02-05 08:59:59 +01:00
Robert Reif f87056fca3 Fixed #2539 (segmentation fault of cppcheck) 2011-02-04 20:19:49 +01:00
Robert Reif 8288c28b3f Fixed #2537 (segmentation fault of cppcheck) 2011-02-03 07:57:10 +01:00
Raphael Geissert f8e2d50e6f Use Token::simpleMatch where no special patterns are needed 2011-02-02 13:27:02 -06:00
Raphael Geissert cf2b6f7bc1 Remove useless spacing at the end of *Match strings 2011-02-02 13:27:01 -06:00
Robert Reif 79862573ba Symbol database: better unit testing. ticket: #2468 2011-01-28 08:33:02 +01:00
Daniel Marjamäki 524498e439 Tokenizer: collapse operator function names into a single token. ticket: #2519 2011-01-27 18:44:20 +01:00
Robert Reif f5b26222ff Symbol database: better handling of functions returning function pointer. ticket: #2468 2011-01-23 22:31:35 +01:00
Robert Reif 2a3cce5001 Symbol database: fixed corruptions. ticket: #2468 2011-01-23 08:41:31 +01:00
Robert Reif 8abae6f1e5 Symbol database: match copy-constructor better. ticket: #2484 2011-01-22 17:43:36 +01:00
Robert Reif 0746c2410a Symbol database: Fixed memory leak. ticket: #2468 2011-01-22 08:36:47 +01:00
Robert Reif d73709a620 Symbol database: rename variables. ticket: #2468 2011-01-21 07:42:41 +01:00
Robert Reif 9dce0dd75c Symbol database: refactoring of classAndStructTypes parsing. ticket: #2468 2011-01-20 18:02:52 +01:00
Pete Johns 0e1bab6dc3 Merge branch 'multi_indirection_templates' 2011-01-18 21:08:04 +11:00
Pete Johns 62063aa250 Refactored to remove code duplication. 2011-01-18 20:51:57 +11:00
Pete Johns abfd907763 Made isVariableDeclarationIdentifiesTemplatedPointerToPointerVariable() pass.
And added isVariableDeclarationIdentifiesTemplatedArrayVariable() (passing) into the bargain.
2011-01-18 20:14:12 +11:00
Robert Reif c994508c3e Symbol database: Refactor the variables API. ticket: #2468 2011-01-18 07:32:06 +01:00
Robert Reif 959e10cee5 Symbol database: renamed classes. ticket: #2468 2011-01-17 18:29:19 +01:00
Robert Reif bf9528558e Symbol database: pulled out classes into global scope. ticket: #2468 2011-01-17 07:21:59 +01:00
Pete Johns 7918c4b804 isVariableDeclaration() now detects template variables. 2011-01-17 08:36:53 +11:00
Pete Johns 38c37ad2d8 Moved array declaration detection into isVariableDeclaration() 2011-01-17 08:36:52 +11:00
Daniel Marjamäki 93d1313186 Refactoring: Check if type is class/struct through symbol database 2011-01-16 19:57:29 +01:00
Robert Reif 66be74a5af Symbol database: Refactorings. Move check-specific code to check. Ticket: #2468 2011-01-16 16:37:11 +01:00
Robert Reif 0f6644e1ea Symbol database: Refactorings 2011-01-16 11:18:12 +01:00
Robert Reif 79b9939610 Fixed #2465 (False positive: not initialised variable, but there is default constructor for it.) 2011-01-15 07:59:37 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Robert Reif 56ffde402f Fixed #2425 (segmentation fault of cppcheck) 2011-01-07 07:42:00 +01:00
Robert Reif 03a484554c Fixed #2415 (false positive: Member variable not initialized in constructor calling assignment operator) 2011-01-06 07:56:34 +01:00
Pete Johns 502cfe7243 Fixed #2384 ("The function 's::f' can be const" reported for pointer-to-pointer)
Moved check for pointer variables into isVariableDeclaration()

Can now handle multiple scopes and multiple levels of indirection. Simplified check for strucs and unions, too, reducing the size of getVarList().

skipScopeIdentifiers() and skipPointers() should probably be methods on class Token.
2010-12-31 22:12:32 +11:00
Pete Johns 2e61736c73 Refactoring following #2377 (Technically the member function xxx can be const)
symboldatabase now recognises variables with arbitrarily many scopes.

Extracted method isVariableDeclaration()

Added unit tests for isVariableDeclaration in new file testsymboldatabase.cpp

Extracted givenACodeSampleToTokenize helper class into testutils.h to reduce duplication.
2010-12-30 19:46:44 +11:00
Pete Johns 5d0ace3a50 Fixed #2377 (Technically the member function xxx can be const)
TODO: Add unit test for getVarList() and refactor variable check.

[Removed my testcase for #2377 and removed two TODOs.]
2010-12-30 17:56:28 +11:00
Robert Reif 3f1f50e970 simplifyTypedef: operator typedef. Ticket: #2375 2010-12-29 20:22:06 +01:00
Robert Reif 244974a61a unused variables: fixed false negatives with the help of the symbol database. ticket: #2317 2010-12-21 08:13:40 +01:00
Robert Reif f2d69acbfd Symbol database: reuse in CheckOther. Ticket: #2318 2010-12-16 19:04:47 +01:00
vBm 46a11183a5 Fixed some spelling mistakes 2010-12-15 18:45:53 +01:00
Robert Reif c6e67d4aad Symbol database: use symbol database in the memory leaks function checking. Ticket: #2219 2010-12-08 07:49:01 +01:00
Robert Reif 980a90071c Fixed #2282 (Improve check: Function can be const) 2010-12-07 19:42:30 +01:00
Robert Reif 6c719c5806 Symbol database: removed unnecessary null pointer checks 2010-12-07 07:07:07 +01:00
Robert Reif c20b8831ee Fixed #2275 (False Positive: Member variable not initialized in the constructor) 2010-12-04 20:24:13 +01:00
Robert Reif 04b811b74f Fixed #2273 (False Positive: Member variable not initialized in the constructor) 2010-12-04 17:47:00 +01:00
Robert Reif 758fc85a12 Memory leaks: Determine that some classes are not auto-deallocated. Reduce false negatives. Ticket: #2219 and #1618 2010-12-04 07:29:12 +01:00
Robert Reif 2cd8bc74cc Symbol database: The symbol database has a bug where it can find an out of line constructor when looking for a destructor. Ticket: #2272 2010-12-03 07:35:06 +01:00
Robert Reif 1bc8a2b6ba Fixed #2172 (False positive: struct is not initialized in constructor) 2010-12-02 07:35:01 +01:00
Robert Reif 43dcc51752 Fixed #2252 (segmentation fault with enable=all) 2010-11-30 19:52:42 +01:00
Robert Reif f90236a183 Fixed #2252 (segmentation fault with enable=all) 2010-11-30 19:40:32 +01:00
Robert Reif ad91f414db Symbol database: Avoid possible null pointer dereference if _settings is null. Ticket: #2219 2010-11-25 17:55:44 +01:00
Robert Reif 03b12c5494 Fixed #2230 (segmentation fault of cppcheck) 2010-11-25 07:43:39 +01:00
Robert Reif 08b86e0b7e Fixed #2228 (False positive: Claims function can be const when it can not be (shared_ptr)) 2010-11-25 07:15:33 +01:00
Robert Reif 1842a122da reuse symbol database in checkmemoryleak.cpp. ticket: #2219 2010-11-23 18:41:07 +01:00
Robert Reif f1eef49fcb Fixed #2221 (segmentation fault of cppcheck) 2010-11-23 07:31:15 +01:00
Robert Reif 27cae2f0d7 Symbol database: add global space and add all global functions and variables to it. Ticket: #2198 2010-11-20 07:26:50 +01:00
Robert Reif 77a5d4e399 Fixed #2204 (False positive when using const class members) 2010-11-16 07:30:55 +01:00
Daniel Marjamäki a06a1a6574 Symbol database: Added files 2010-11-13 08:08:45 +01:00