Commit Graph

238 Commits

Author SHA1 Message Date
PKEuS 18693a7fce Refactorized token.cpp:
- Removed redundant overload of Token::insertToken()
- Fixed leak in Token::deleteThis()
- Moved condition out of loop in Token::tokAt()
2015-12-14 22:04:51 +01:00
Alexander Mai 9d8dffbd79 #6269 false positives in case of overloaded standard library functions. Detect memset() with proper argument cound, using new function numberOfArguments() 2015-12-06 12:50:05 +01:00
Alexander Mai e69377d5a8 #7183 CheckClass::checkMemset() uint overflow. Plus some minor refactoring 2015-12-05 18:22:01 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 636bf75799 Fixed crash on garbage code (#7074) 2015-10-26 13:29:47 +01:00
PKEuS 0370c66e41 Fixed broken function Token::getCharAt() (#7073) 2015-10-26 11:51:05 +01:00
Philipp Kloke a837cc48e0 Refactorization: Simplified code in tokenlist.cpp, token.cpp and testthreadexecutor.cpp 2015-10-19 09:01:20 +02:00
Daniel Marjamäki 40fffddb83 avoid some fixes for noisy signedness warnings 2015-10-11 12:36:23 +02:00
PKEuS 50ed47c725 Fixed crash on garbage code (#7022) 2015-10-07 13:52:06 +02:00
Daniel Marjamäki 9b253612ca SymbolDatabase: Add type information in AST 2015-10-04 19:42:58 +02:00
PKEuS fbbdfa85ca Revert "Fixed false negative #5815"
This reverts commit dc6c278d83.
2015-09-09 14:46:47 +02:00
PKEuS dc6c278d83 Fixed false negative #5815 2015-08-31 14:12:19 +02:00
Daniel Marjamäki 436d7b6d59 Merge pull request #655 from Dmitry-Me/explicitConstCastBetterNames
Use const_cast to add const, better variable name
2015-08-27 17:04:07 +02:00
Dmitry-Me c760ccee13 Use const_cast to add const, better variable name 2015-08-27 17:14:33 +03:00
PKEuS 2ace3d3144 Rewritten handling of declaration specifiers:
- Removed simplifyConst() because it did the opposite of the (superior) simplifyStaticConst()
- Execute simplifyStaticConst() in simplifyTokenList1() - there is no reason to defer it, and it is required to properly parse declarations like "unsigned static int i;"
- Fixed simplifyStaticConst() to handle more patterns. It did not work at the beginning of the token list and for function arguments
- Reimplemented Tokenizer::simplifyStdType()
-> properly support all possible ways to declare integers as requested by the standard, instead of only a few common permutations of "unsigned|signed", "short|char|long|int"
-> Fixed parsing of _Complex/complex types
2015-08-27 14:34:17 +02:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Daniel Marjamäki 6865724c4e Fixed #6914 (Token::expressionString: parenthesis missing in expression (*it)->stats.corpse_ticks) 2015-08-12 10:55:25 +02:00
Daniel Marjamäki e598b07a6d Moved functions to astutils 2015-08-03 09:20:50 +02:00
Daniel Marjamäki 251f6d2a15 Fixed #6898 (Token::expressionString: wrong output when first token is post-incremented) 2015-07-31 07:03:52 +02:00
Daniel Marjamäki ae124cb365 ValueFlow: Attempt to make --debug output easier to understand by using words 2015-07-26 16:32:31 +02:00
Daniel Marjamäki 9197e70a8d ValueFlow: Changed --debug output so we can see if a variable is known or possible 2015-07-26 15:36:09 +02:00
PKEuS 8ed0180279 Use C++11 string.back() instead of string[string.length()-1] 2015-07-25 17:19:53 +02:00
Daniel Marjamäki e5151a13ab Fixed #6867 (False positive memleak) 2015-07-25 11:37:03 +02:00
Daniel Marjamäki b2b4bb49fa Refactoring handling of comparisons 2015-07-22 12:31:18 +02:00
Daniel Marjamäki 2e2735518e AST: Updated printAst 2015-07-21 11:54:11 +02:00
Alexander Mai b604d63dd8 #6726 cppcheck hangs with 100% CPU load (invalidcode) inside Token::astOperand2(). #6840 egmentation fault (invalid code) in Token::astOperand2. Improve stability on invalid code 2015-07-15 15:19:48 +02:00
Alexander Mai b30d9ffe98 #6838 cppcheck hangs on some strange input code. Token::astOperand1/2 throw internal error on garbage code instead of creating endless recursion in AST 2015-07-14 21:07:10 +02:00
Alexander Mai 6e03e7dca2 Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0. Run astyle 2015-07-01 07:50:13 +02:00
amai2012 99dfd55d0c #6804 segmentation fault (invalid code) in Token::getValueTokenDeadPointer. Fix null pointer access
TestGarbage: Increase coverage by running all code snippets as C as well as C++ code. (inspired by #6800)
2015-06-30 19:40:22 +02:00
amai2012 c0b91662ba #6803 segmentation fault (invalid code) in Token::findClosingBracket. 2015-06-30 12:16:55 +02:00
Alexander Mai d704e97203 Fix (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope 2015-06-10 21:14:17 +02:00
Dmitry-Me cae605b1ec New warning: warn about redundant code in condition. 2015-06-10 18:53:55 +02:00
Daniel Marjamäki 75b0430ba5 Token::strValue: fixed handling of backslash 2015-06-07 11:25:33 +02:00
Daniel Marjamäki eb0db322eb Fixed #6560 (ValueFlow: handling ternary operator better in valueFlowSubFunction) 2015-05-24 17:02:00 +02:00
Alexander Mai 394160184a Refactoring: Replace complex if/else cascade by search in a container. Remove redundant plain arrays (in favour of container) 2015-05-24 09:43:17 +02:00
PKEuS d5ad1def40 Removed two unused functions 2015-04-09 20:54:07 +02:00
Daniel Marjamäki e3bff8ff07 astyle formatting 2015-03-29 21:05:18 +02:00
Dmitry-Me e36ff852cd Don't call abort() in the middle of C++ code 2015-03-26 15:26:08 +03:00
Simon Martin ec1eebf585 Ticket #6587: Never consider a template parameter's default value as an instantiation. 2015-03-21 16:30:00 +01:00
PKEuS 9bafa3bf25 Fixed false positive #6575 2015-03-11 20:25:27 +01: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 b69528eb80 Bailout in Token::getValueTokenDeadPointer() if reference is used (#6399) 2015-01-30 19:29:37 +01:00
Thomas Jarosch 2bcd675653 Verbose AST dump: Show if token is expanded from macro
I also added the token variable id, but that decreased
readability of the AST tree too much.
2015-01-17 23:20:52 +01:00
PKEuS e39729ffcc Library: Add <container> tag to Libraries, provide configuration for std::vector, std::deque, std::array and STL strings
Token: Added function to jump to the next template argument
2015-01-03 22:18:33 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Robert Reif 9e60f584d9 Fixed #6321: Implemented function Token::swapWithNext(). 2014-12-27 10:53:26 +01:00
PKEuS 4d81945ac5 Fixed a couple of #6276 integer over/underflow issues 2014-12-09 23:28:22 +01:00
PKEuS 1df1b9c2bd Fixed #5836: Make showing $ in stringified tokens optional 2014-09-29 14:50:00 +02:00
Simon Martin 53b58f0ed9 Refactoring. Use Token::Match instead of hardcoded patterns to increase readability. 2014-09-14 11:26:16 +02:00