Commit Graph

85 Commits

Author SHA1 Message Date
PKEuS eb2962792f Implemented support for move constructors:
- Changed behaviour of Token::function - is now also set for declarations
- Resolved TODO in testclass.cpp
- removed redundant code in Scope::findFunction - it is safe to call nextArgument() on functions without arguments
- Use Token::function in checkother.cpp
2013-04-04 10:53:55 -07:00
PKEuS 188096665c Implemented support for rvalue references (C++11):
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.

Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Robert Reif 3f57b5a6ca Fixed #4682 (using 'struct' disables checking) 2013-03-28 06:36:49 +01:00
Ettl Martin 1b9c1c03fa unittests: removed not needed '\n' at the end of testcases. 2013-03-20 15:36:16 +01:00
PKEuS 641ac5c02a Fixed #4352: Ensure that class provides an iterator interface. 2013-03-14 09:00:22 -07:00
PKEuS 14feaa8d39 Refactorizations:
- Fixed lots of cppcheck messages about functions that can be const or static
- Fixed possible nullpointer dereference message in symboldatabase.cpp
- Replaced tokAt(+-1) by next()/previous()
2013-03-12 07:42:00 -07:00
PKEuS 2a312efd6e Adapted testsymboldatabase.cpp to recent changes 2013-03-05 06:46:34 -08:00
PKEuS 66a3555897 Implement initial support for Types in Symboldatabase:
- For each class/struct/union, a Type instance is added to SymbolDatabase::typeList.
- A scope is no longer created for declared but not defined types

Fixed name detection for classes when they are declared like this: "class ::Foo::Sub {..."
2013-03-05 04:33:38 -08:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Robert Reif a0d8fd26fe SymbolDatabase: improved handling of const in function parameters 2013-01-27 02:46:00 +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
Daniel Marjamäki 38d1b064e8 Symbol database: Add support for unnamed array arguments to functions (#4444) 2012-12-29 08:32:43 +01:00
Robert Reif bd2f59bdf0 Fixed #4442 (crash of cppcheck while scanning gcc-testsuite (invalid code)) 2012-12-28 08:36:20 +01:00
Robert Reif 35c2b8058d Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails) 2012-11-30 06:03:58 +01:00
PKEuS 472a39d157 Fixed two MSVC warnings in testsymboldatabase.cpp 2012-11-01 18:55:15 +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
XhmikosR 3c14e4b52a test: tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-17 13:51:40 +02:00
PKEuS f762b55aa0 Fixed MSVC 10 compiler warnings 2012-09-16 16:29:06 +02:00
Daniel Marjamäki ae7ee5ffd3 Symbol database: Added TODO test case for #3190 2012-09-15 20:13:32 +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 3449684137 Fixed usage of _settigns->isEnabled("style") in CheckIO. Added forgotten test cases. 2012-09-10 16:23:00 +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 3032ded9aa replaced tabs with spaces 2012-09-05 19:46:44 +02:00
PKEuS 00f6c635b8 Detect functions returning a template type in SymbolDatabase
Fixed comment
2012-08-22 03:37:50 -07:00
Edoardo Prezioso 358fb9a284 Fixed the GCC Wshadow warnings introduced recently. 2012-08-12 17:04:37 +02:00
Daniel Marjamäki 9f6a11f89c SymbolDatabase: Added unit test that ensure the dimension is 0 when it is unknown (#3964) 2012-08-10 11:01:12 +02:00
PKEuS 68e19b33ff Fixed parsing of C++11 initializatation in initializer list (#3957) 2012-07-10 06:15:11 -07: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 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
Daniel Marjamäki 62f9875f90 Fixed #3799 (Bug: Function gets varId) 2012-05-13 07:55:35 +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 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 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
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 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
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