PKEuS
9dfb864522
Fixed two nullpointer messages in cppcheck
2015-02-01 15:21:09 +01:00
PKEuS
a4cc4c3e3f
Refactorization: Use SymbolDatabase scope information in ValueFlow
2015-02-01 12:10:20 +01:00
PKEuS
21cb0cfd60
Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072 )
2015-01-31 20:12:02 +01:00
PKEuS
1f97e3001b
Fixed calculation of array size ( #6487 )
2015-01-31 19:06:44 +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
Samir Aguiar
141a071792
* Added Clang-related flag to gui.pro
...
* Updated external lib location with PWD variable
2015-01-20 19:20:00 +01:00
Thomas Jarosch
c0aceb893e
Replace custom code with Settings::isWindowsPlatform()
2015-01-18 12:43:43 +01:00
Thomas Jarosch
9a5260a43f
Only simplify Windows's DEBUG_NEW macro on Windows platform
2015-01-18 12:20:23 +01:00
Robert Reif
193645318b
Tokenizer: Remove macro in class declaration like 'class DLLEXPORT Fred {}' to be able to handle the class better later
2015-01-17 07:42:49 +01:00
Aneesh Azhakesan S
fe5d2fc245
Fixed #5906 (false negative: 'else if' expression is always false (use library to determine if function is pure))
2015-01-10 12:21:55 +01:00
PKEuS
7452613479
Refactorization:
...
- Merged messages exceptThrowInNoexecptFunction, exceptThrowInNoThrowFunction, exceptThrowInAttributeNoThrowFunction and exceptThrowInDeclspecNoThrowFunction into a single message.
- Merged Token::fIsDeclspecNothrow into Token::fIsAttributeNothrow
2015-01-09 20:18:09 +01:00
Daniel Marjamäki
6a8293a8b7
Library: More strict matching of functions
2015-01-08 19:31:41 +01:00
orbitcowboy
ba837a6f2d
Added support for strpbrk to std.cfg. Running astyle.
2015-01-07 02:34:41 +01:00
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
PKEuS
fd5ff1bb8b
Fixed false positive #6030 : inheriting classes is not a variable declaration.
2014-08-06 09:04:03 +02:00
PKEuS
83a80cebeb
Fixed order of simplifications ( #6029 )
2014-08-06 08:39:23 +02:00
PKEuS
f3e0df7501
Support C++11 style initialization with {}:
...
-> Support in setVarId and SymbolDatabase (#4344 )
-> Fixed false positives in unused variable checking (#5491 , #5494 )
Side-effect: Support global variables initialized with brackets (C++03 style) in SymbolDatabase
2014-08-05 15:33:57 +02:00
Daniel Marjamäki
4dc73e3a5b
Use Token::simpleMatch for simple pattern
2014-08-01 17:47:02 +02:00
Daniel Marjamäki
3f5da22d2b
Tokenizer: Added FIXME for keywords handling
2014-08-01 17:27:35 +02:00
Daniel Marjamäki
a943a0739a
Tokenizer: Don't remove struct member in Tokenizer::simplifyKeyword()
2014-08-01 17:19:08 +02:00
Dmitry-Me
dc03b98e60
Run cheaper check first, don't check the same condition twice.
2014-07-28 14:58:19 +04:00
Dmitry-Me
431453f53e
Reuse previously computed values, use more const.
2014-07-25 15:05:13 +04:00
Daniel Marjamäki
2e60f30bfc
Merge pull request #372 from Dmitry-Me/dontUseArrayAtWhenItWouldntThrow
...
Use [], not at() when the index is guaranteed to be valid.
2014-07-23 14:15:42 +02:00
Daniel Marjamäki
c5e9da2984
xml dump: add more token attributes
2014-07-21 12:44:53 +02:00
Dmitry-Me
cd13232062
Use [], not at() when the index is guaranteed to be valid.
2014-07-21 10:37:08 +04:00
Daniel Marjamäki
328cc7b8f5
Fixed #5996 (false positive: Clarify calculation precedence for '+' and '?'.)
2014-07-19 18:29:53 +02:00
Daniel Marjamäki
946c139043
Merge pull request #367 from Dmitry-Me/fixVariableCapitalization
...
Fix variable capitalization.
2014-07-18 11:15:17 +02:00
Alexander Mai
55e45add4a
Fix compiler warnings
2014-07-17 20:04:56 +02:00
Dmitry-Me
f995f67a11
Fix variable capitalization.
2014-07-17 12:38:09 +04:00
Daniel Marjamäki
b1e5b015df
xml dump: output some more info in the dump
2014-07-16 15:27:13 +02:00
orbitcowboy
af6f21308f
Tokenizer: Added missing comma in string array initialization (This fixes Coverity-ID: 1226263 Missing comma in a string array initialization).
2014-07-12 12:52:49 +02:00
orbitcowboy
6e5a05104b
Fixed copy and paste error (Coverity-ID: 1226262 Copy-paste error).
2014-07-12 12:48:05 +02:00
Daniel Marjamäki
b6a9c53826
xml dump: fixed some bad xml output in the token list dump
2014-07-14 19:49:31 +02:00
Daniel Marjamäki
8db5836e3f
Fixed #5982 (Add xml dump)
2014-07-14 15:51:45 +02:00
Daniel Marjamäki
954400a382
Add simple xml debug output. When both --xml and --debug is used there will be xml debug output.
2014-07-13 17:21:45 +02:00
Dmitry-Me
ba3757dfd3
Bring variables decalaration to where they are really needed.
2014-07-10 11:23:14 +04:00
Dmitry-Me
d0cbfeb186
Use references instead of deep copying the strings
2014-07-09 11:21:38 +04:00
Daniel Marjamäki
14def42c99
Fixed #5972 (FP: Buffer is accessed out of bounds)
2014-07-08 16:31:08 +02:00
Daniel Marjamäki
d40b77dce2
Removed special 'else if' handling. this is redundant since these are simplified.
2014-07-02 16:16:19 +02:00
Zachary D. Blair
f6523e384b
Fixed 4979 (Doesn't allow any ordering of int modifiers)
2014-07-01 23:59:04 -07:00
Simon Martin
7b942650c2
Ticket #5952 : Simplify redundant parentheses in pointer variable declarations.
2014-06-28 09:36:51 +02:00
PKEuS
b20f87faf2
Optimized Tokenizer::simplifyPlatformTypes() once more: Another 3% improvement on Windows.
...
-> All Token::Match strings are uppercase, so check Token::isUpperCaseName() to avoid comparisons with very slow long Token::Match strings (idea from amai)
Removed duplicate Token::Match call in symboldatabase.cpp
2014-06-25 20:42:59 +02:00
PKEuS
360fd4a565
Speedup Tokenizer::simplifyMathFunctions() and Tokenizer::simplifyPlatformTypes()
...
-> Speedup on entire checking time (TortoiseSVN code) by 3% (MSVC12, x64, not matchcompiled). Probably only measurable when checking code with Windows platform.
2014-06-25 17:00:59 +02:00
Daniel Marjamäki
ae81b09b58
Refactoring: Move isScopeNoReturn implementation to library and reuse it both in ValueFlow and Tokenizer
2014-06-22 19:13:15 +02:00
Alexander Mai
2e3f26ba58
Patch from Dmitry-Me: reorder checks so that cheaper ones go first, reuse previously computed values, return early on edge condition
2014-06-16 21:36:31 +02:00
Simon Martin
efb12f0409
Ticket #5268 : Properly detect function heads when in Tokenizer::simplifyEnum.
2014-06-15 15:52:58 +02:00
Daniel Marjamäki
17f1841fba
Merge pull request #339 from simartin/ticket_5868
...
Ticket #5868 : Ignore variables called like a typedef when substituting typedefs
2014-06-14 12:38:02 +02:00
PKEuS
8b9daadd25
Replaced static variable isCPP in Token (was not threadsafe):
...
- Encapsulate parameters passed through AST compiler functions in a struct
-> Reduces maintenance overhead when changing them
-> Contains parameter indicating if the file is C or C++
- Added eKeyword Token type (at the moment, only true for C++ keyword "delete", but should be set for other keywords as well)
2014-06-14 10:28:12 +02:00
Simon Martin
d588ed49b3
Ticket #5868 : Ignore variables called like a typedef when substituing typedefs.
2014-06-14 00:50:14 +02:00
Daniel Marjamäki
a4a6f3e1be
Tokenizer: Removed Tokenizer::simplifyConditionOperator(). Using the AST and ValueFlow, it should be much easier to parse ?: than before.
2014-06-10 19:30:13 +02:00
Simon Martin
dc12a73987
Ticket #5907 : Properly handle extern declarations in Tokenizer::simplifyVarDecl.
2014-06-08 14:59:58 +02:00