PKEuS
35d94c26d5
Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
...
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness
The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS
2ab33ef21b
Added Pointer to enclosing scope to class Token (Only available when symboldatabase is created).
2012-08-11 11:47:11 -07:00
PKEuS
45bad7d1b2
Refactorized tokenizer:
...
- Don't run setVarId() twice, keep old varId's while/after simplifyTokenList
-> Modified two test cases in testmemleak.cpp. I consider this to be safe. Feel free to investigate this.
- Fixed two nullpointer issues shown by cppcheck
Ran Astyle on teststl.cpp
2012-08-10 09:31:22 -07:00
Edoardo Prezioso
1d8240356b
Really fixed #4024 . Now the simplification won't be done on non-executive scopes.
2012-08-10 17:43:09 +02:00
Daniel Marjamäki
0254344df5
Tokenizer::simplifyEnum: Reverted refactorings/optimisations as there were regressions ( #3949 , #3950 , #4025 )
2012-08-10 14:06:24 +02:00
Edoardo Prezioso
d68d035e22
Tokenizer::simplifyFlowControl: separated the 'throw' case because it's not a reserved keyword in C, hence the function shouldn't simplify in C source files.
2012-08-07 19:38:51 +02:00
Daniel Marjamäki
735c0f5f6b
Fixed #3963 (segmentation fault of cppcheck (invalid typedef code))
2012-08-07 16:39:41 +02:00
Edoardo Prezioso
9e916eec66
Fixed #4024 (Tokenizer::simplifyFlowControl removes pieces of code inside a class if 'exit' is a member function).
2012-08-07 10:59:27 +02:00
Daniel Marjamäki
5ee7758a83
Fixed #4015 (segmentation fault of cppcheck (enum))
2012-08-06 16:21:21 +02:00
Daniel Marjamäki
25fd841b5d
Tokenizer: removed redundant include
2012-08-05 16:06:20 +02:00
PKEuS
452f95cea0
More robust template detection in clarifyCondition check based on Token::link. ( #3818 )
...
Create links between < and > only on non-C code.
AStyle fix
2012-08-02 04:03:01 -07:00
PKEuS
c8e40773f1
Fixed cppcheck messagesa about functions that can be const/static:
...
- Made Tokenizer::getErrorMessages static - Avoids creation of unnecessary instance of Tokenizer
- Changed Tokenizer::removeExceptionSpecifications to common style for simplification functions. In contrast to the comment, this function doesn't call itself recursivly - fixed comment.
- Made Tokenizer::IsScopeNoReturn static.
2012-08-01 12:04:47 -07:00
Ettl Martin
98d608231d
spelling fixes
2012-07-31 23:35:56 +02:00
PKEuS
1ec3c9f634
Fixed hang in libreoffice code (simplification of K&R style function declaration tried to simplify a function with parameters without name whose implementation contained "; {".
...
Test cases of this simplification only need basic simplifications done in Tokenizer::tokenize
2012-07-29 06:11:48 -07:00
Daniel Marjamäki
1a6f7ea9a0
Fixed #3998 (Tokenizer::simplifyEnum: wrong handling of expressions => crash)
2012-07-26 11:12:28 +02:00
Ville Skyttä
7ab2f6a9fa
Spelling fixes.
2012-07-21 18:11:20 +02:00
Daniel Marjamäki
a96ec0ad46
Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers))
2012-07-16 07:28:59 +02:00
PKEuS
e9182f1fcc
Implemented support for 'using namespace std;': Add std:: prefix to names that are known to be in std namespace. Simplify namespace (std::)tr1:: if C++11 flag is set.
2012-07-15 02:05:19 -07:00
Edoardo Prezioso
fae40c4782
Change every C version of 'size_t' to C++ 'std::size_t'.
2012-07-09 13:30:18 +02:00
Daniel Marjamäki
bf98e952c1
Fixed #3927 (false positive: (error) Uninitialized variable: new)
2012-07-08 13:59:00 +02:00
Daniel Marjamäki
49198f52c4
Fixed #3934 (False positive for logical conjunction with enum and define)
2012-07-07 15:34:26 +02:00
Daniel Marjamäki
543ccdd4c0
Removed simplifyEnum timer that I didn't intend to include in the previous commit.
2012-07-06 15:48:51 +02:00
Daniel Marjamäki
6ad5fc8456
Refactoring Tokenizer::simplifyEnum. The enum handling is now somewhat faster since all enum values of a enum are simplified at the same time.
2012-07-06 15:43:50 +02:00
Thomas Sondergaard
f72ddbb2e9
Fixed #3912 (Analysis failed)
2012-07-03 06:34:14 +02:00
Daniel Marjamäki
bb9f114d84
Fixed #3924 (False positive: Uninitialized variable (const pointer))
2012-06-30 12:12:36 +02:00
Daniel Marjamäki
8af044255d
Tokenizer: Added new function isFunctionParameterPassedByValue that check if a parameter is passed by value
2012-06-24 13:40:09 +02:00
Daniel Marjamäki
edea4ef131
Refactoring: Renamed CheckNullPointer::isPointer to Token::isUpperCaseName
2012-06-21 19:00:53 +02:00
Daniel Marjamäki
974225626d
Fixed #3901 (false positive: (error) Uninitialized variable: temp)
2012-06-19 20:07:39 +02:00
Daniel Marjamäki
4b6e1c6946
Fixed #3855 (false positive: (error) Instance of 'locale' object destroyed immediately)
2012-06-13 19:21:20 +02:00
August Sodora
90f92250dd
Fixed #3618 (segmentation fault of cppcheck)
2012-06-12 21:07:17 +02:00
Daniel Marjamäki
54a66391d8
Fixed #3750 (false positive: C-style pointer casting)
2012-06-12 18:45:31 +02:00
seb777
5b763a9f0a
Fixed #3579 (object destroyed immediately:False positive & negative)
2012-06-10 21:52:32 +02:00
August Sodora
e146591b5d
Fixed #3544 (segmentation fault of cppcheck)
2012-06-02 16:15:12 +02:00
PKEuS
9dc8123151
Refactorizations:
...
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
Daniel Marjamäki
5b0551054a
varid: better templates handling
2012-05-22 18:58:13 +02:00
PKEuS
a9cfe2814a
Made some functions const according to cppcheck results
2012-05-17 02:54:17 -07:00
PKEuS
4bb2a1b27b
Made some functions static or const according to cppcheck results
2012-05-17 01:33:24 -07:00
Daniel Marjamäki
505aa6e4cc
TestSimplifyTokens::enum29: Fixed crash
2012-05-16 21:39:26 +02:00
Daniel Marjamäki
0bb0fdedc2
Fixed #3747 (False 'boolean result in bitwise' message with 'mask' enums)
2012-05-16 18:48:33 +02:00
PKEuS
0157f937bf
Fixed #3760 : Added explicit to C++ keyword list in setVarId
...
Made some constant arrays static
2012-05-16 01:59:52 -07:00
Daniel Marjamäki
4ae8e4f382
Tokenizer::setVarId: Minor fix of sizeof handling
2012-05-15 18:40:24 +02:00
Daniel Marjamäki
a0e5fad6a9
Fixed #3776 (Tokenizer::setVarId: No varid set when unknown macro is used before variable declaration)
2012-05-15 07:17:31 +02:00
Daniel Marjamäki
62f9875f90
Fixed #3799 (Bug: Function gets varId)
2012-05-13 07:55:35 +02:00
Daniel Marjamäki
8236cd4d50
Fixed #3785 (false positive: (style) Variable 'dinv' is assigned a value that is never used)
2012-05-08 12:04:54 -07:00
Daniel Marjamäki
99a29eafc9
Fixed #3691 (Tokenizer::simplifyKnownVariables: continue in switch)
2012-05-07 12:11:23 -07:00
PKEuS
28f6e2f4a9
Resolved cyclic dependency between Tokenizer and TemplateSimplifier
2012-05-06 01:38:55 -07:00
PKEuS
f105bf75a6
Refactorizations in ErrorLogger:
...
- Implemented constructor for ErrorLogger::ErrorMessage that takes a callstack of tokens -> replaced duplicate code in Check and Tokenizer
- Implemented strigify() for ErrorLogger::ErrorMessage::FileLocation to replace two identical implementations of it.
2012-05-06 01:17:15 -07:00
PKEuS
1a5fbd61d2
Splitted class TokenList from Tokenizer
2012-05-05 09:33:26 -07:00
Daniel Marjamäki
11614021e8
Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string')
2012-05-05 09:59:43 +02:00
Daniel Marjamäki
119b24e363
Fixed #3756 (False positive: uninitvar in malloc)
2012-05-03 19:10:51 +02:00