cppcheck/lib
rebnridgway 431d068339 Several fairly significant optimisations (#1518)
* Code changes for Token::mImpl optimisation

* Added new TokenImpl optimisation

Moving members to the TokenImpl struct reduces the size of the Token class, which is a fairly significant optimisation.  In my testing on Windows with 32-bit Release-PCRE, this change reduced the size of the Token class from 108 bits to 52 bits and reduced run-time of my test case by around 20%.

* Several optimisations

Deleted some code that ran very slowly and did nothing, as there is no need to change a Token's string to null if you are about to delete it.
Added a frontToken to simplifyCalculations to reduce the amount of work it has to do on already-simplified calculations.
Moved template removal to the end of the list as this reduces redundant iteration and saves time.

* Added tok argument to simplifyCalculations

This means callers can avoid unnecessary work if they know which tokens have already been simplified.  Passing nullptr indicates the original behaviour (starting from the front of the list).

* Removed mention of member from another change

* Re-added and optimised some code deleted in error

Changing mTemplateInstantiations to a vector avoids the high cost of doing repeated linear searches.  Changing how the code iterates through the array was necessary because the vector can be resized at several points during the loop, which breaks existing references and iterators.

* Changed mTemplateInstantiations to a vector

This is an optimisation that makes repeated linear searches of this collection significantly faster. 
Also added a copy constructor to TokenAndName so code can make copies of these objects to keep a reference if a vector gets resized.

* A cleaner optimisation to removing template tokens

This reverts the previous change to made mInstantiatedTemplates a vector and the iterator changes to support this, and makes mTypesUsedInTemplateInstantiation so the eraseTokens logic can be unified.

* Reverted vector to list

Also made mTypesUsedInTemplateInstantiation a vector of TokenAndName objects so it can share the same logic as the other members.

* Added member for template simplifier pointer

This can be used more efficiently than marking Tokens with a flag and then searching through all templates to find the one that matches.

* Turned loop inside out

This means we only have to iterate through the std::list once.  std::list is very expensive to iterate through.

* Latest code from danmar and fixed optimisations

In particular I have optimised simplifying template instantiation names as this was incredibly slow because of the number of times it had to iterate through the template instantiation list.  Previous optimisations to this weren't very effective and broke some edge cases.

* Added changes from danmar

Made mExplicitInstantiationsToDelete a vector of TokenAndName to be consistent with the rest of the members, which are cleaned up very efficiently.

* Tokens can have many templateSimplifierPointers

* templateSimplifierPointers must be kept in sync
2018-12-21 13:51:45 +01:00
..
CMakeLists.txt
analyzerinfo.cpp Fix Cppcheck shadow variable warning 2018-11-03 19:41:25 +01:00
analyzerinfo.h Updated copyright year 2018-10-13 18:20:31 +02:00
astutils.cpp Fixed #8914 (False positive with unary_function argument) 2018-12-19 19:43:05 +01:00
astutils.h Issue 8830: New check: Function argument evaluates to constant value 2018-12-17 06:04:24 +01:00
check.cpp Updated copyright year 2018-10-13 18:20:31 +02:00
check.h Renamed Check::_name 2018-06-16 16:31:07 +02:00
check64bit.cpp Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
check64bit.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkassert.cpp Use functions instead of comparing with enum (#1471) 2018-11-09 06:30:41 +01:00
checkassert.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkautovariables.cpp Fix issue 8865: FP with dangling lifetime 2018-12-01 19:07:46 +01:00
checkautovariables.h Issue 6175: Check lifetime of a variables stored in containers and member variables 2018-11-21 08:43:57 +01:00
checkbool.cpp Use functions instead of comparing with enum (#1471) 2018-11-09 06:30:41 +01:00
checkbool.h Add check for return value of boolean function (#1451) 2018-11-01 11:08:16 +01:00
checkboost.cpp Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
checkboost.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkbufferoverrun.cpp Refactor isVLAIndex 2018-11-23 20:23:20 +01:00
checkbufferoverrun.h Rename private member variables 2018-06-17 17:20:16 +02:00
checkclass.cpp Fixed #8817 (Change wording in performance/functionStatic) 2018-12-03 18:30:54 +01:00
checkclass.h Disabled CheckClass::checkCopyCtorAndEqOperator because of FP (#8388) 2018-09-08 09:14:02 +02:00
checkcondition.cpp Issue 8830: New check: Function argument evaluates to constant value 2018-12-17 06:04:24 +01:00
checkcondition.h Add a pass in valueflow for terminating conditions (#1323) 2018-11-07 06:49:07 +01:00
checkexceptionsafety.cpp Refactoring; Use range for loops 2018-07-14 09:49:03 +02:00
checkexceptionsafety.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkfunctions.cpp Fix false positive: Invalid string argument with array (#1439) 2018-10-19 07:48:47 +02:00
checkfunctions.h #4241: Check for address of single character passed as string (#1381) 2018-10-14 18:49:34 +02:00
checkinternal.cpp Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
checkinternal.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkio.cpp checkio: Add missing id "invalidScanfFormatWidth_smaller" to errorlist output (#1533) 2018-12-20 21:14:02 +01:00
checkio.h checkio: Add missing id "invalidScanfFormatWidth_smaller" to errorlist output (#1533) 2018-12-20 21:14:02 +01:00
checkleakautovar.cpp Added a few TODO comments 2018-11-20 22:57:01 +01:00
checkleakautovar.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkmemoryleak.cpp Code cleanup 2018-12-17 18:54:32 +01:00
checkmemoryleak.h CheckMemoryLeak: Cleanup the old memory leaks check 2018-12-17 18:12:50 +01:00
checknullpointer.cpp Take back the whole program analysis for null pointers and uninitialized variables 2018-12-18 07:56:33 +01:00
checknullpointer.h Take back the whole program analysis for null pointers and uninitialized variables 2018-12-18 07:56:33 +01:00
checkother.cpp Fixed #7907 (FN: redundant assignment inside switchcase, overwritten by assignment outside of switch) 2018-12-17 16:10:47 +01:00
checkother.h Issue 8830: New check: Function argument evaluates to constant value 2018-12-17 06:04:24 +01:00
checkpostfixoperator.cpp Refactoring: Use ranged for loop 2018-07-13 16:50:12 +02:00
checkpostfixoperator.h Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
checksizeof.cpp Use for arithOperationsOnVoidPointer messages 2018-09-26 17:58:22 +02:00
checksizeof.h Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
checkstl.cpp Refactor CheckStl::stlOutOfBounds 2018-11-28 20:30:58 +01:00
checkstl.h CheckStl: Improving checking of container access out of bounds 2018-11-28 19:27:28 +01:00
checkstring.cpp Use functions instead of comparing with enum (#1471) 2018-11-09 06:30:41 +01:00
checkstring.h Fix --doc output. * must be escaped. 2018-10-11 13:59:21 +02:00
checktype.cpp Refactoring; use range for loop 2018-07-13 16:57:17 +02:00
checktype.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
checkuninitvar.cpp Take back the whole program analysis for null pointers and uninitialized variables 2018-12-18 07:56:33 +01:00
checkuninitvar.h Take back the whole program analysis for null pointers and uninitialized variables 2018-12-18 07:56:33 +01:00
checkunusedfunctions.cpp Fixed #8677 (False positive: unused method) 2018-08-08 11:31:35 +02:00
checkunusedfunctions.h Rename private member variables 2018-06-17 18:58:27 +02:00
checkunusedvar.cpp CheckUnusedVar: Cleanup checker 2018-12-17 17:48:45 +01:00
checkunusedvar.h CheckUnusedVar: Cleanup checker 2018-12-17 17:48:45 +01:00
checkvaarg.cpp Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
checkvaarg.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
config.h
cppcheck.cpp change severity for 'unknown macro' to error for now. 2018-11-13 21:08:45 +01:00
cppcheck.h Ticket 7792: Suppression both exit_code and syntaxError when call cppcheck suppressions (#1345) 2018-09-08 11:09:49 +02:00
cppcheck.natvis Fixed Visual Studio Natvis file after recent refactoring (#1299) 2018-07-09 08:27:26 +02:00
cppcheck.vcxproj Copy platforms/ directory to bin/ 2018-02-27 09:09:12 +01:00
cppcheck.vcxproj.filters
errorlogger.cpp relative paths: another fix for {code} 2018-11-18 16:15:09 +01:00
errorlogger.h relative paths: show {code} properly when there are relative paths 2018-11-18 16:08:08 +01:00
importproject.cpp Fixed #8864 (compile commands: handle define with string value) 2018-11-25 15:09:23 +01:00
importproject.h fixed issue 8661: Misleading error message when compilation database is not recognized 2018-07-25 16:26:25 +02:00
lib.pri
library.cpp Fixed #8697 (noreturn output stream) 2018-08-21 06:32:33 +02:00
library.h Rename Library::isargvalid() 2018-07-15 23:05:48 +02:00
matchcompiler.h
mathlib.cpp Correct detection of Microsoft extensions in MathLib::isValidIntegerSuffix. Remove public overloaded implementation which was not used outside mathlib.cpp. (#1531) 2018-12-20 12:20:31 +01:00
mathlib.h Correct detection of Microsoft extensions in MathLib::isValidIntegerSuffix. Remove public overloaded implementation which was not used outside mathlib.cpp. (#1531) 2018-12-20 12:20:31 +01:00
path.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
path.h Updated copyright year 2018-01-14 15:37:52 +01:00
pathmatch.cpp Updated copyright year 2018-10-13 18:20:31 +02:00
pathmatch.h Updated copyright year 2018-10-13 18:20:31 +02:00
pcrerules.pri
platform.cpp Updated copyright year 2018-03-31 20:59:09 +02:00
platform.h Fix Cppcheck error message 2018-10-20 15:28:34 +02:00
preprocessor.cpp Fixed handling of macros with known value defined in header file in configuration splitting (#8404) 2018-10-08 16:38:47 +02:00
preprocessor.h Renamed private member file0 2018-06-17 09:06:16 +02:00
settings.cpp Updated copyright year 2018-10-13 18:20:31 +02:00
settings.h Renamed --debug to --debug-simplified 2018-08-05 11:19:20 +02:00
standards.h Updated copyright year 2018-01-14 15:37:52 +01:00
suppressions.cpp Suppressions::NO_LINE : fixed comparisons 2018-09-23 16:50:51 +02:00
suppressions.h suppressions: Avoid duplicate comparison. 2018-10-04 17:13:11 +02:00
symboldatabase.cpp Improve trailing return type support. (#1520) 2018-12-13 06:34:10 +01:00
symboldatabase.h Improve trailing return type support. (#1520) 2018-12-13 06:34:10 +01:00
templatesimplifier.cpp Several fairly significant optimisations (#1518) 2018-12-21 13:51:45 +01:00
templatesimplifier.h Several fairly significant optimisations (#1518) 2018-12-21 13:51:45 +01:00
timer.cpp Rename private member variables 2018-06-17 17:20:16 +02:00
timer.h Rename private member variables 2018-06-17 17:20:16 +02:00
token.cpp Several fairly significant optimisations (#1518) 2018-12-21 13:51:45 +01:00
token.h Several fairly significant optimisations (#1518) 2018-12-21 13:51:45 +01:00
tokenize.cpp template simplifier: fix explicit instantiation with types starting with const and ending in * and &. (#1530) 2018-12-19 21:59:59 +01:00
tokenize.h Tokenizer: Add simplifyAt to handle some nonstandard code with @ 2018-12-04 16:52:41 +01:00
tokenlist.cpp Optimization: Removed unnecessary calls to simplifyPath(). The Caller should do this, and our callers (mainly the test suite) more or less do so, as they all supply just dummy paths ("test.cpp") 2018-12-18 20:33:45 +01:00
tokenlist.h relative paths: show {code} properly when there are relative paths 2018-11-18 16:08:08 +01:00
utils.h Revert "Refactoring endsWith utility function" 2018-07-25 16:14:43 +02:00
valueflow.cpp Disable the subfunction value flow analysis. It does not work well and needs to be rewritten. There are false positives. 2018-12-18 14:36:49 +01:00
valueflow.h astyle formatting 2018-11-10 21:30:01 +01:00
version.h Set version to 1.86.99/1.87 dev 2018-12-08 11:53:37 +01:00
version.rc