Commit Graph

3581 Commits

Author SHA1 Message Date
Daniel Marjamäki fb6c7f33f0 Fixed #3707 (Uninitialized variable with operator >> and templates) 2012-04-24 19:50:54 +02:00
PKEuS e0a3ca0845 Refactorizations in class Token: changed handling of different types of tokens.
- Replace _isNumber, _isName, _isBoolean attributes by a single _type attribute (enum Token::Type), because not two of the old booleans could be true at the same time.
-> Add support for lots of different other kinds of tokens. (More precise checking of token type possible)
-> Replaced instant checking of type for Operators, etc. by a value calculated at creation time. (Faster checking)
2012-04-23 21:05:26 +02:00
PKEuS 8cbed66089 Changed relationship between templatesimplifier and tokenizer:
- Pass a tokenizer to templatesimplifier to reduce code duplication (Make use of Tokenizer::reportError; remove redundant TemplateSimplifier::addtoken2) and amount of arguments passed to functions

Removed ctor and dtor implementation from TemplateSimplifier: This class shouldn't be instanciated.
2012-04-23 20:45:36 +02:00
Daniel Marjamäki 6ae135124e Tokenizer::setVarId: better handling of initializer lists 2012-04-23 18:26:27 +02:00
PKEuS 5086ae7c31 Refactorizations in CheckMemoryLeakInClass::variable
- Bailout for functions that are not implemented (should fix performance downgrade introduced in fb4709f)
- Jump behind arguments
- Removed unnecessary pop_back operations - container gets destroyed after it.
2012-04-23 15:23:01 +02:00
Daniel Marjamäki 706631f527 Fixed #3748 (False positive out of bounds with postincrement) 2012-04-22 12:22:49 +02:00
Daniel Marjamäki d5f6cfcfa8 Tokenizer: Use new setVarId function. Removed the old one. 2012-04-22 11:36:31 +02:00
PKEuS 3d2b5a30fe Implemented generic reportError functions in tokenizer (similar to Check::reportError) to reduce code duplication 2012-04-22 11:28:46 +02:00
Daniel Marjamäki 8c8c9d5e5b Tokenizer::setVarIdNew: don't treat '(sizeof *p)' as a variable declaration 2012-04-22 11:06:56 +02:00
Daniel Marjamäki d63093d9bb Tokenizer::setVarIdNew: Fixed issue found through TestUnusedVar tests 2012-04-22 10:59:58 +02:00
Daniel Marjamäki 871823e9c6 Tokenizer::setVarId: fixed problem for classes with inheritance 2012-04-22 10:38:06 +02:00
Daniel Marjamäki e39b7f1bfd Tokenizer::setVarIdNew: Fixed TestTokenizer::varid38 2012-04-22 10:24:19 +02:00
Daniel Marjamäki e745d971c8 Tokenizer::setVarIdNew: Fixed test case TestTokenizer::varid27 2012-04-22 10:19:29 +02:00
Daniel Marjamäki b4ffb5e0cf Tokenizer::setVarIdNew: Fixed TestTokenizer::varid39 test case 2012-04-22 09:51:00 +02:00
Daniel Marjamäki ed6673a9aa Tokenizer::setVarIdNew: Fixed TestTokenizer::varid44 2012-04-22 09:18:27 +02:00
Daniel Marjamäki 71050bc586 Tokenizer::setVarIdNew: fixed TestTokenizer::varid_in_class2 test case 2012-04-22 08:51:19 +02:00
Ahti Legonkov 79af6f65d7 Fixed #3699 (cppcheck hangs with 100% cpu load on parsing preprocessor code) 2012-04-22 06:49:42 +02:00
Edoardo Prezioso be5a61b794 Fixed ticket #3721 (false positive: syntax error on valid C code ( K&R function style )). 2012-04-22 01:56:40 +02:00
PKEuS 710fefeef0 Refactorizations:
- Replaced some indendation counters by Token::link() or usage of symbolDatabase
- Use Token::nextArgument() to jump to target parameter
2012-04-21 23:05:37 +02:00
Daniel Marjamäki 6d9b4a8032 Tokenizer::setVarIdNew: Fixed TestTokenizer::varid_operator test case 2012-04-21 19:29:24 +02:00
Daniel Marjamäki 1cc256339c Tokenizer::setVarIdNew: Fixed TestTokenizer::varid19 test case 2012-04-21 18:22:18 +02:00
Daniel Marjamäki 42a95c9202 Tokenizer::setVarIdNew: Fixed segfault when using new setVarId on invalid code 2012-04-21 18:02:26 +02:00
Daniel Marjamäki bd60dd46d0 Tokenizer::setVarIdNew: handle special case when there is an unknown macro. Ticket #2638 2012-04-21 17:57:20 +02:00
Daniel Marjamäki b86295fbcd Tokenizer::setVarIdNew: Improved C++ handling. All the TestTokenizer::varidclass?? tests pass now. 2012-04-21 17:25:44 +02:00
Daniel Marjamäki 6071a5afc3 Tokenizer::setVarIdNew: Fixed varidclass9 2012-04-21 13:39:43 +02:00
Daniel Marjamäki 85b470c41b Tokenizer::setVarIdNew: Better C++ handling (varidclass5 and varidclass13) 2012-04-21 13:11:30 +02:00
Daniel Marjamäki 1492d8990f Tokenizer::setVarId: better C++ handling 2012-04-19 20:58:52 +02:00
PKEuS af80344ab7 Refactorizations in checkclass.cpp:
- Removed local isVirtual implementation in checkclass.cpp, use Function::isImplicitlyVirtual instead
- Don't bailout when we see C++-style casts in checkConst
- Don't bailout for this pattern "any << member << any"
- Improved/Fixed some test cases (-> #1305)
2012-04-18 18:51:38 +02:00
PKEuS 6a37c36ee8 Fixed #3741
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS cb7537418a Make use of Token::findClosingBracket in templatesimplifier.cpp 2012-04-18 16:16:06 +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 1793bf8928 Fixed false positive in stlBoundries check (#3740) 2012-04-18 10:08:59 +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 bb4184ca03 Tokenizer::setVarIdNew: better handling of class variables 2012-04-17 19:06:00 +02:00
PKEuS 8e5949c6ce Added several C++11 algorithms and containers to CheckStl
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320)
2012-04-17 12:54:01 +02:00
PKEuS 82cd022646 Refactorized CheckStl::mismatchingContainersError:
- Improved error message
- Made patterns more generic by using Token::nextArgument()
2012-04-17 12:21:41 +02:00
Ettl Martin 09d41b2f84 ticket 2669: added todo testcase 2012-04-17 00:31:32 +02:00
Reijo Tomperi 4e2946a8d0 Fix spelling error: unecessary unnecessary 2012-04-16 21:33:16 +03:00
PKEuS bac8ed7127 Refactorized stringification of tokens:
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
Daniel Marjamäki 5ad1840120 Tokenizer::setVarIdNew: Copied code from Tokenizer::setVarIdOld that sets varid in member functions 2012-04-16 19:48:58 +02:00
PKEuS 1c3c94dc67 New simplification: Remove 'extern "C"' from C++ code.
Refactorization in cppcheck.cpp: Catch exception as const reference instead of non-const reference.
2012-04-16 16:25:04 +02:00
PKEuS 8cb904feaa Refactorizations in class Token:
- Added support for < and > in nextArgument()
- Made isStandardType inline by writing its implementation to token.h (like other bool is*() functions)
- Made firstWordEquals return bool instead of integer (only 0 and 1 were returned)
- Use std::string::empty() instead of operator==(""); Use character literals instead of string literals for single characters printed.
2012-04-16 15:28:38 +02:00
PKEuS 66d947675f Refactorizations in tokenize.cpp:
- Removed a few indendation counters
- Removed unnecessary pattern "- >" because this code is simplified to "." before.
- Generalized pattern of simplifyFunctionReturn()
- Simplified removeExeptionSpecification, no longer recursive (-> #3385)
2012-04-16 10:49:09 +02:00
Daniel Marjamäki 8f866c6e4c Tokenizer::setVarIdNew: handle c++ keyword 'using' 2012-04-15 18:29:35 +02:00
Daniel Marjamäki c58d02f146 Tokenizer::setVarIdNew: in C code, allow that variable declaration starts with delete and throw 2012-04-15 18:23:12 +02:00
Daniel Marjamäki ea148173bb TemplateSimplifier: Allow that template parameter starts with :: 2012-04-15 18:15:36 +02:00
Daniel Marjamäki b0dc708b4d Tokenizer::setVarIdNew: variable declarations dont start with NOT/goto/return/delete/etc 2012-04-15 18:02:49 +02:00
Daniel Marjamäki 46bfe27831 Tokenizer::setVarIdNew: Better handling of function calls 2012-04-15 17:44:51 +02:00
Daniel Marjamäki 31f8a71f84 Tokenizer::setVarIdNew: Better handling for catch-exception-by-reference 2012-04-15 17:39:22 +02:00