Commit Graph

1764 Commits

Author SHA1 Message Date
Daniel Marjamäki 8a6bb46958 Tokenizer: only print AST in debug output if --verbose is used 2015-01-07 06:46:04 +01:00
Daniel Marjamäki b0cc46e98b reverted 840b2fb0, it caused FN. tweaked the Tokenizer::simplifyAssignmentBlock to fix the FP it caused. 2015-01-07 06:38:42 +01:00
Daniel Marjamäki 840b2fb035 Tokenizer: Removed simplification Tokenizer::simplifyAssignmentBlock. This fixes a fp in linux. 2015-01-06 20:44:58 +01:00
Daniel Marjamäki d1927e3492 Removed Tokenizer::simplifyStructInit simplification. 2015-01-04 16:48:52 +01:00
Daniel Marjamäki 7bafbfbd6e Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux) 2015-01-04 13:50:54 +01:00
PKEuS 016e89e422 Refactorizations:
- Disabled some parts of setVarId() for C code.
- Fixed mistake in <contaier> documentation
2015-01-04 10:52:11 +01:00
Daniel Marjamäki eb1c048d2a Tokenizer: Fix wrong simplification when checking linux kernel 2015-01-03 21:35:03 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS 274e1a838a Fixed #5871: Properly parse initialization list in setVarId() if constructor is declared as noexcept 2015-01-02 20:03:06 +01:00
PKEuS 88990bac59 Fixed #6386: Improved behaviour on unknown language (header file) 2015-01-02 12:32:23 +01:00
PKEuS 5dc45bd4ac Fixed #5497: Support designated initializers in array size detection 2014-12-30 19:23:01 +01:00
Thomas Jarosch 69b31a0743 Fix up extra whitespaces in match patterns
Detected by new internal check.
2014-12-30 14:53:43 +01:00
PKEuS 990d14f3e2 Fixed #6328: Use isAttributeNoreturn() whereever we also check Library::isnoreturn(). 2014-12-27 11:07:36 +01:00
Robert Reif 9e60f584d9 Fixed #6321: Implemented function Token::swapWithNext(). 2014-12-27 10:53:26 +01:00
Daniel Marjamäki 06803ee333 Refactoring Tokenizer::simplifyAttribute 2014-12-24 13:03:38 +01:00
Daniel Marjamäki fb3f5a159d Token: Added flag for attribute noreturn (#6328) 2014-12-24 12:50:51 +01:00
Daniel Marjamäki 90bd38a972 Renamed isCasted to isCast 2014-12-24 10:35:40 +01:00
Daniel Marjamäki 1b2a23b3fe Fixed #6350 (Tokenizer::simplifyCast: set Token::isCasted when cast is removed) 2014-12-23 16:16:14 +01:00
PKEuS 4d81945ac5 Fixed a couple of #6276 integer over/underflow issues 2014-12-09 23:28:22 +01:00
Dmitry-Me ff6604e289 Make expensive string manipulation depend on settings 2014-12-09 06:08:38 +01:00
Daniel Marjamäki 64e6b5186d astyle formatting 2014-12-05 06:41:47 +01:00
Matthias Krüger 7a6cd54059 Fix [lib/tokenize.cpp:6184]: (warning) Found simple pattern inside Token::Match() call: ") {" 2014-12-04 11:11:47 +01:00
Daniel Marjamäki e3892a95b5 Fixed #6290 (Tokenizer: Because 'and' is not simplified to '&&' there are false positives) 2014-12-03 16:32:05 +01:00
Dmitry-Me cf3f8c2f38 Refactoring: Replace names with underscores with camelCase names 2014-12-01 16:22:56 +01:00
Dmitry-Me 828fdb6c47 Code cleanup. Omit redundant check. 2014-11-28 17:48:23 +01:00
Robert Reif 418c2e51a0 Fixed #3314 (cppcheck incorrectly reporting Syntax error.) 2014-11-28 17:44:36 +01:00
Robert Reif 0dad8b64e8 Fixed #6268 (False positive functionStatic (inconclusive) - nested namespaces) 2014-11-27 06:29:33 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
PKEuS 428587f3d4 Fixed #6275: Simplification of = (NULL); to = 0; 2014-11-18 19:39:38 +01:00
PKEuS ad8749c0bd Fixed #6278: Remove casts to references to pointers in Tokenizer::simplifyCasts() 2014-11-18 19:23:59 +01:00
Daniel Marjamäki ea765c24f2 Fixed #3262 (Tokenizer: wrong 'return a=1,b=2,...;' simplification;) 2014-11-10 17:31:19 +01:00
Robert Reif df6855c216 SymbolDatabase: reintroduce test, move symboldatabase cleanup code to SymbolDatabase destructor 2014-11-02 10:36:52 +01:00
Robert Reif 4eb33e7479 SymbolDatabase: Refactoring of findFunction 2014-11-01 14:36:17 +01:00
PKEuS c7d315fba3 Refactorization: Changed simplifyMathFunctions() to a single pass simplifier 2014-10-31 23:08:11 +01:00
PKEuS f8371f65f0 Refactorization: Avoid string copying. 2014-10-31 22:36:44 +01:00
PKEuS 9b0b7a77b6 Removed unnecessary conditions and avoid string copying in Tokenizer::simplifyMathFunctions() 2014-10-31 13:59:39 +01:00
PKEuS d29117c4b2 Rearranged some code in simplifyTypedef 2014-10-30 23:48:23 +01:00
PKEuS 6fdaf65cea Fixed createLinks2() when > is followed by ; (#6242) 2014-10-30 11:15:24 +01:00
Simon Martin c6e2107d99 Ticket #6187: Avoid infinite loop if eraseDeadCode does not remove anything (this time without memory corruption). 2014-10-22 20:25:36 +02:00
Daniel Marjamäki e965d8de67 Merge pull request #455 from Dmitry-Me/refactorNumberIsX
Reuse code in isXNumber() to avoid duplication and unneeded computations
2014-10-21 15:30:19 +02:00
Dmitry-Me c3fa85b282 Reuse code in isXNumber() to avoid duplication and unneeded computations 2014-10-21 16:02:35 +04:00
Robert Reif 42f709c09d Fixed #6229 (Move Windows builtin types __intXX to library) 2014-10-21 06:11:19 +02:00
Robert Reif e2f72b4cb1 Fixed #6215 (Move Windows platform types into library) 2014-10-19 07:34:40 +02:00
Frank Zingsheim 3923618b8d Fixed #6222 (Missing varid for multiple braced initialized variables)
-> Fixed broken code in unit tests
2014-10-16 20:46:57 +02:00
PKEuS eefaddf980 Fixed bug in Tokenizer::simplifyReference() (#6133) 2014-10-16 11:43:42 +02:00
PKEuS 6955e719cf Collected garbage code tests and moved them to testgarbage.cpp 2014-10-16 10:59:46 +02:00
Daniel Marjamäki ecd17d84fb Reverted f088588c fix for #6187 that fixes infinite loop, the fix cause a use-after-free regression. 2014-10-16 06:32:06 +02:00
Frank Zingsheim eab0878b8a Support {} initialization in initializer list (#6216) 2014-10-15 21:33:21 +02:00
Daniel Marjamäki 17cab08cba Tokenizer::setVarId: Refactored fix to avoid varId for function name 2014-10-15 06:47:09 +02:00
Daniel Marjamäki 36297f1025 Tokenizer::varId: don't set varid for function name in code 'bool f(X x, int=3);' 2014-10-14 20:37:32 +02:00
Daniel Marjamäki 30353d4b61 Tokenizer::setVarId: better handling of c++ casts 2014-10-11 18:35:06 +02:00
Simon Martin 70561682eb Tokenizer::simplifyConstTernaryOp: Properly detect the end of the 'false' part of ternary operators when it contains '>'. 2014-10-11 17:01:55 +02:00
Daniel Marjamäki 8c8e85d2db Tokenizer::setVarId: A variable declaration can't start with the typedef keyword 2014-10-11 16:30:51 +02:00
Daniel Marjamäki dd6ae3033f Tokenizer::simplifyRedundantParentheses: dont remove parentheses in 'void * operator new(SIZE_TYPE, int);' 2014-10-11 09:18:43 +02:00
Daniel Marjamäki b0b86f5607 Fixed internal error, use Token::simpleMatch for pattern 'const new' instead of Token::Match 2014-10-10 18:58:04 +02:00
Daniel Marjamäki 19a05b1f53 Tokenizer::setVarId: don't set varid for 'auto' keyword 2014-10-10 16:46:31 +02:00
amai2012 85500dcdbd Merge pull request #453 from simartin/ticket_5625
Ticket #5625: Simplify constant ternary operator in template parameters.
2014-10-06 09:01:08 +02:00
amai2012 cddb4af10b Merge pull request #450 from simartin/ticket_6187
Ticket #6187: Avoid infinite loop if eraseDeadCode does not remove anything
2014-10-06 08:59:56 +02:00
Simon Martin 9ddf857dc7 Ticket #5625: Simplify constant ternary operator in template parameters. 2014-10-04 20:49:57 +02:00
PKEuS a02712cb66 Some small refactorizations:
- Removed redundant calls to std::string constructor
- Use default parameters in some places
2014-10-03 10:02:46 +02:00
PKEuS 14f15d65e7 Support more patterns when replacing stuff like 'or' (#6201) 2014-10-01 08:41:55 +02:00
Simon Martin f088588c88 Ticket #6187: Avoid infinite loop if eraseDeadCode does not remove anything (invalid goto into a dead loop's body). 2014-09-30 19:43:22 +02:00
PKEuS 448195f255 Added variable name to debug message about typeStartToken()
Fixed cppcheck message
2014-09-29 14:36:03 +02:00
PKEuS de13ad7eca Improved simplifications of redundant loops:
- Execute simplifyWhile0 after simplifyKnownVariables (#394)
- Support declaration of variable in loop header in removeRedundantFor
2014-09-26 10:47:05 +02:00
Dmitry-Me b17f2eea16 Cache search result to avoid dual search 2014-09-22 15:54:17 +04:00
Daniel Marjamäki f93cf9d1b7 Fixed #6170 (Tokenizer: sizeof on array in 2d-array is not handled properly) 2014-09-16 17:21:17 +02:00
Dmitry-Me b479948f0f Refactoring: Merge overlapping Token::Match function calls 2014-09-16 06:22:16 +02:00
Daniel Marjamäki 29a49d0641 removed some redundant null pointer checks before calling Token::Match 2014-09-14 11:35:04 +02:00
Simon Martin 53b58f0ed9 Refactoring. Use Token::Match instead of hardcoded patterns to increase readability. 2014-09-14 11:26:16 +02:00
Simon Martin 4b750997cb Ticket #6121: Report a syntax error for invalid enum initializers. 2014-09-13 20:46:53 +02:00
Dmitry-Me 961a1b65ae Merge partially duplicate patterns 2014-09-12 19:10:41 +04:00
Matthias Krüger 323fd1b3dc tokenize.cpp: fix internal warning: Found simple pattern inside Token::Match() call: ") :" 2014-09-08 22:00:57 +02:00
Frank Zingsheim 8c5013adda Fixed #6073 2014-09-07 21:53:32 +02:00
Daniel Marjamäki db929ffd19 Fixed CID 1037074. Useless null pointer check. Created ticket #6144. 2014-09-07 13:50:55 +02:00
PKEuS 35b00a5e05 Support rValue references in typedef (#1823) 2014-09-06 19:00:26 +02:00
Simon Martin eeeb816db9 Ticket #6103: Simplify "new (type)" constructs into "new type" to avoid confusion upon certain input. 2014-09-05 08:02:18 +02:00
PKEuS 8c24553229 Support inherited member variables in setVarId (#4101) 2014-09-04 22:22:09 +02:00
PKEuS a52401cf1b Fixed some compiler warning about signed/unsigned conversions. 2014-09-02 11:44:51 +02:00
PKEuS 3e65cb446e Remove "auto" keyword (storage class specifier) from C++03 and C code (#4990). 2014-09-02 11:21:47 +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 3ccdae78ba Support __declspec(property) (#4700) 2014-08-31 20:17:18 +02:00
PKEuS 6a4319f050 Improved simplifications:
- Rearranged their order to solve problems with typedefs. If we simplify chained declarations before typedef parsing, we have less complex expressions to deal with (#4777).
- Fixed detection of variables hiding enums
2014-08-26 15:21:19 +02:00
PKEuS 2326e78381 Fixed #6058: Don't detect class with unknown macro as variable.
Commented out crashing unit test tokenize33() in VS12
2014-08-26 10:40:00 +02:00
amai2012 e02741c82c #5780 Crash on template code below Tokenizer::setVarId(). Fix several crashes with same location. 2014-08-26 09:12:10 +02:00
Dmitry-Me 67ea470275 Break loop early, cleanup declarations 2014-08-24 20:17:41 +02:00
PKEuS 7f2be2f57c Fixed template bracket linkage in while loop simplification
Ran AStyle
2014-08-23 12:28:54 +02:00
PKEuS c678937538 Fixed more false positives of #6056:
- Implemented nextArgument() for usages before < and > are linked
- slightly optimized nextArgument()
2014-08-20 15:02:52 +02:00
PKEuS 5d50e7e9ae Changed heuristics to detect variable constructor initialization syntax (#6071) 2014-08-19 11:06:52 +02:00
PKEuS eac2d58c9e Fixed fix for #6056 2014-08-18 20:40:43 +02:00
Dmitry-Me 120e8c0674 Make loop termination more explicit. 2014-08-18 14:00:25 +04:00
PKEuS e7754be316 Fixed #6056 - properly detect member functions in setVarId() 2014-08-18 11:07:56 +02:00
PKEuS 5c54f8d0d8 Support namespaces and static member variables in setVarId (only one depth) (#6061) 2014-08-18 10:25:30 +02:00
Daniel Marjamäki a52c122229 Tokenizer::createLinks2: set no template-links in 'if (a < b || c > d)' 2014-08-17 19:03:06 +02:00
Daniel Marjamäki 5cdbe0f42d ValueFlow: Improved value flow after for loop 2014-08-17 10:40:22 +02:00
Daniel Marjamäki 75ec97ad23 Tokenizer::simplifyKnownVariables: Fixed bad simplification in for loop header 2014-08-17 07:39:42 +02:00
Daniel Marjamäki 65f10edcb6 Fixed #5866 (False negative: useless condition or null pointer dereference (null object after while loop, method)) 2014-08-16 18:32:25 +02:00
PKEuS e4b55cf843 Fixed a bug and two warnings introduced recently. 2014-08-06 13:35:39 +02:00
PKEuS adcc8b1634 Implement support for __attribute__((used)) (#3408) 2014-08-06 11:13:58 +02:00