Commit Graph

9602 Commits

Author SHA1 Message Date
Daniel Marjamäki 7b106c067a Fixed #8603 (SymbolDatabase: 2 scopes with same function) 2018-06-03 23:14:24 +02:00
Daniel Marjamäki df9b243227 Modernize: use ranged for loops in CheckNullPointer 2018-06-03 09:27:18 +02:00
Matthias Krüger 0771a81969 Revert "tokenlist::iscast(): save a few pointer dereferences."
This reverts commit e187fdb696.
2018-06-02 15:57:56 +02:00
rebnridgway d3b231214d TemplateSimplifier optimisation. measured time improvement for cryptopp/test.cpp is ~8.4s => ~8.35s 2018-06-02 13:49:14 +02:00
Matthias Krüger 558a2f0cc7 SymbolDatabase::createSymbolDatabaseFindAllScopes(): hoist _tokenizer->isC(PP) dereference out of loop. 2018-06-02 13:38:15 +02:00
Matthias Krüger e187fdb696 tokenlist::iscast(): save a few pointer dereferences. 2018-06-02 13:19:22 +02:00
Daniel Marjamäki 7163210f72 Fixed #8605 (Segmentation fault below TemplateSimplifier::simplifyCalculations) 2018-06-01 23:03:53 +02:00
Matthias Krüger be6c273e6b CheckBufferOverrun::checkScope_inner(): save a few pointer derefernces (NFC). 2018-05-31 12:28:34 +02:00
Daniel Marjamäki 02f9ab38b4 simplifyCalculations: Made this function ~30% faster when analysing lib/tokenize.cpp 2018-05-31 06:36:59 +02:00
amai2012 8d55d361ae #8602 Template default parameter without name yields syntax error 2018-05-30 17:09:31 +02:00
IOBYTE 7681bbf227 Fixed #8146 (false positive: enum initialized using class member initializer syntax in struct in struct) (#1270) 2018-05-30 15:40:16 +02:00
Daniel Marjamäki 4c9bde277a Refactoring: Use ranged for in TemplateSimplifier 2018-05-30 14:40:38 +02:00
Daniel Marjamäki f7148cbaa9 Refactoring: Renamed iterator 2018-05-30 14:33:55 +02:00
Daniel Marjamäki cc77a6aa62 Code refactoring 2018-05-29 22:41:37 +02:00
IOBYTE 3982c81394 Add support for C++ attribute nodiscard for functions. (#1269) 2018-05-29 21:43:56 +02:00
Daniel Marjamäki 14e60210c9 Optimize Tokenizer::setVarIdPass1 2018-05-29 18:41:05 +02:00
orbitcowboy 5861a3844a Running astyle [ci skip]. 2018-05-29 17:32:55 +02:00
orbitcowboy de66eedd54 Improved const correctness of local variables. 2018-05-29 17:33:43 +02:00
Daniel Marjamäki 7d4a80fbd2 astyle formatting
[ci skip]
2018-05-29 16:30:33 +02:00
orbitcowboy 33777c5b72 Improved const correcntess of local variables. 2018-05-29 13:24:48 +02:00
orbitcowboy b94e5ab9cb Fixed VS2017 C4101: unreferenced local variable. 2018-05-29 13:18:07 +02:00
orbitcowboy bf20aa2330 token.h: Added const-qualifiers to some functions. 2018-05-29 11:46:07 +02:00
Daniel Marjamäki d7dfa29864 Preprocessor: only throw errors upon request. 2018-05-28 14:11:59 +02:00
Daniel Marjamäki c2c43ce8a7 Code cleanup, use '= delete' 2018-05-28 12:44:18 +02:00
Daniel Marjamäki 02c8a1d61c Tokenizer::setVarIdPass1 optimization 2018-05-28 11:32:47 +02:00
IOBYTE 36f7585798 Fixed #8600 (false-positive/regression: confusion between copy constructors of internal classes and lack of explicit keyword) (#1266) 2018-05-27 10:53:34 +02:00
orbitcowboy 1914d5e630 Running astlye 2018-05-25 08:35:37 +02:00
rebnridgway 42a65c5160 Fix crash bug #8579 (#1238)
* Added declaration for deletePrevious function

* Added definition for deletePrevious function

* Fixed crash from deleteThis invalidating pointers

The crash was caused by deleteThis() invalidating the pointer to a constant variable usage.  This happened when a usage followed an assignment.  This fixes bug #8579.

* Added tokensFront to match tokensBack

This means deletePrevious can set the list's front if necessary.

* Initialised tokensFront in appropriate places

* Switched to using default Token constructor

* Switched to using Token default constructor

* Switched to using default constructor for Token

* Added missing argument to Token constructor

* Changed to use default constructor for Tokens

* Switched to using default constructor for Tokens

* Switched to using default constructor for Token

* Added new test for deleting front Token

Also made sure to use the correct constructor for Token in other tests.

* Syntax error

* Replaced tokensFront and tokensBack with a struct

This decreases the size of the Token class for performance purposes.

* Replaced tokensFront and tokensBack with a struct

* Added tokensFrontBack to destructor

* Reworked to use TokensBackFront struct

Also ran astyle.

* Reworked to use TokenList's TokensFrontBack member

* Reworked to use TokensFrontBack struct

* Reworked to use TokensFrontBack struct

* Reworked to work with TokensFrontBack struct

* Removed unnecessary scope operator

* Added missing parentheses

* Fixed syntax error

* Removed unnecessary constructor

* Default constructor now 0-initialises everything

This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.

* Fixed unsafe null check

* Added missing explicit keyword

* Fixing stylistic nits

Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.

* Fixing stylistic nits

Removed default constructor and replaced it with a single-argument constructor with a default value.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.
2018-05-25 07:15:05 +02:00
orbitcowboy 9bf604c46c timer.h: Improved const correctness of local variable. 2018-05-24 17:07:40 +02:00
orbitcowboy d013cb2f0d library.h: Improved const correctness of some function arguments. 2018-05-24 17:06:20 +02:00
Daniel Marjamäki 2ffbb37cee modernize cppcheck.cpp, use range for loops 2018-05-22 23:22:46 +02:00
IOBYTE fc1d62fd45 Fixed #7406 (Tokenizer::simplifyTypedef: array typedef used as template parameter) (#1257) 2018-05-22 17:31:58 +02:00
umanamente a3b02d6ece Fixed #8262: false positive memleak (`shared_ptr` in function argument) (#1249)
* Fixed #8262.
checkleakautovar.cpp:
* added `isFunctionCall` (supports template functions)
* smart pointer check in `functionCall`
* updated test case

* Renamed "bracket" to "parenthesis"

* (#8262) Fixed broken test

* (#8262) Code review comments

* (#8262) Renamed `tokOpeningBr` to `tokOpeningPar`
2018-05-22 09:08:23 +02:00
IOBYTE 8320be203d Fixed #8258 (Incorrect diagnostics when using delegating consturctor with default values) (#1255) 2018-05-22 06:42:37 +02:00
IOBYTE 5c15cd3981 Fix DACA2 SymbolDatabase bailout; unhandled code for final class (#1253)
* Fix DACA2 SymbolDatabase bailout; unhandled code for final class

* Replace Match with simpleMatch
2018-05-21 21:23:21 +02:00
Paul Fultz II 406aa6cf1c Improve support of using a lambda as a deleter (#1246)
* Improve support of using a lambda as a deleter

* Use simple match
2018-05-21 08:22:18 +02:00
IOBYTE 42ed5a6b98 Fixed #8581 (Delegating contructor warns for unintialized variables) (#1250)
* Fixed #8581 (Delegating contructor warns for unintialized variables)

* Replace Token::Match with isStandardType
2018-05-20 22:58:05 +02:00
bwoester 9b28499412 Import BCB6 projects (#1245)
* added support for reading borland c++ builder 6 projects

* add: fetch sysdefines from project
add: start providing bcb6 predefines (WIP)

* configure all the internal defines for BCB6

* make sure define strings don't start with ';'

* improvements on bwoesters BCB6 project support

- improved `*.bpr` XML handling by reducing the number of loops
- added `const` where aplicable
- optimized compiler argument parser performance
- reformatted code with provided astyle config

* - undo looping (keep it the same as the other implementations)
- keep parsing of cflags simple and separate from the synonym cleanup (no need for micro optimization in this place)
- move input validation to FileSettings::setDefines
- re-run astyle

* use [] instead of at() when comparing characters
2018-05-20 18:19:20 +02:00
Daniel Marjamäki 2b14b71c93 Updated output when Cppcheck fails to find valid configurations 2018-05-17 10:27:05 +02:00
amai2012 7062df5d78 #8585 --check-config aborts due to unhandled simplecpp::Output exception 2018-05-17 08:59:10 +02:00
Matthias Krüger 2320034f4a fix -Winconsistent-missing-override warnings reported by clang 6.0. 2018-05-17 08:47:19 +02:00
Alexander Mai fe1b1d537e Fix compiler warning by useless semicolon 2018-05-16 21:33:26 +02:00
IOBYTE d567b878ba Fix template instantialion failure for qualified template type. (#1237) 2018-05-16 15:24:23 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 6bd4bdb0f9 Updated 'noValidConfiguration' message. It should not write this message when there is no code. It should be possible to see the preprocessor errors otherwise it is hard to fix the configuration. 2018-05-15 15:42:54 +02:00
Daniel Marjamäki f7746e4fb6 Revert "Missing override specifier warning on a pure virtual function makes no sense. (#1230)"
This reverts commit 348eb1c5c9.
2018-05-15 10:48:34 +02:00
IOBYTE 348eb1c5c9 Missing override specifier warning on a pure virtual function makes no sense. (#1230)
This fixes a large number of false positives for cppcheck source code.
2018-05-14 23:08:40 +02:00
Daniel Marjamäki d8622ea5f8 simplifyCalculations: Removed redundant goback variable 2018-05-14 23:06:10 +02:00
Daniel Marjamäki 29dc42ff67 Removed unreachable code 2018-05-14 22:50:30 +02:00
PKEuS e8bc955023 Optimized Tokenizer::simplifyFunctionReturn(): Replaced nested loops by two consecutive loops; execute second one only if necessary. 2018-05-14 20:51:09 +02:00