We were calling several interface functions through their inherited
classes instead of using the base classes requiring us to add `friend`
declarations to make the implementations accessible. This adjusts
several of those cases.
There was no need for the `Tokenizer` parameter to be a pointer as it
could never be `nullptr` and was also dereferenced without checking
first.
As a reference to the `Settings` was already available via the
`Tokenizer` there was no need to pass it separately. In the production
code there will only be one instance of it but in the tests we could
have accidentally passed a different one.
* avoid potentially duplicated `strTolower()` call in `Path::getFilenameExtensionInLowerCase()`
* avoid unnecessary copies
* use `unordered_*` containers for faster lookups
* symboldatabase.cpp: do not perform call in `checkReturns()` until needed
* astutils.cpp: do not perform calls in `isVariableChangedByFunctionCall()` until necessary
* tokenize.cpp: small `hasIfDef()` optimization
* use `unordered_map` for `CheckUnusedFunctions::FunctionUsage::mFunctions` / adjusted test case
* fixed functionConst findings and enabled it in selfcheck
* fixed functionStatic findings and enabled it in selfcheck
* .travis_suppressions: adjusted comment
* testimportproject.cpp: added missing asserts
was:
In file included from lib/checkunusedfunctions.cpp:21:
lib/checkunusedfunctions.h:114:15: warning: struct 'FunctionDecl' was previously declared as a class [-Wmismatched-tags]
std::list<struct FunctionDecl> _functionDecl;
^
lib/checkunusedfunctions.h:108:23: note: previous use is here
class CPPCHECKLIB FunctionDecl {
^
lib/checkunusedfunctions.h:114:15: note: did you mean class here?
std::list<struct FunctionDecl> _functionDecl;
^~~~~~
class
1 warning generated.
- Removed definitely unnecessary forward declarations (e.g. "class Token"; token.h is already included by check.h, so a definition is unnecessary)
- Removed unused includes