* Fix#11473 FP constVariable with range-based for / #11448 FP constParameter with unused non-const range loop variable
* Fix ValueType / #11188 FP danglingTempReference with auto
* Fix ValueType in range-based for
* Update symboldatabase.cpp
Use case where it gave an issue:
using customComparator = decltype([] (const X& lhs, const X& rhs) { return lhs.CompareTo(rhs); });
std::map<X, int, costomComparator> m;
Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
* Fix 9392, but for destructors: out-of-line defaulted destructors skipped everything after
Context:
```
struct S {
~S();
};
S::~S() = default;
void g() {
int j;
++j;
}
```
Everything after `S::~S() = default;` was skipped, so the uninitialized variables in g() weren't found.
Out-of-line destructors are useful e.g. when you have a forward declared unique_ptr in the .h,
and `= default` the destructor in the .cpp, so only the cpp needs to know the header for destructing
your unique_ptr (like in the pImpl-idiom)
* Fix unit test, by correctly fixing 10789
Previous commit broke this test, but also provided the tools for a cleaner fix
* Document current behaviour
* Rewrite control flow
* Fix deleted functions, which skipped everything after
`a::b f() = delete` triggered the final else in SymbolDatabase::addNewFunction,
which sets tok to nullptr, effectively skipping to the end of the stream.
* Remove troublesome nullptr, which skips every analysis afterwards
It was introduced in 0746c241 to fix a memory leak.
But setting tok to nullptr, effectively skipping to the end, seems not needed.
Previous commits fixes prevented some cases where you could enter the `else`.
This commit is more of a fall back.
* fixup! Fix deleted functions, which skipped everything after
`a::b f() = delete` triggered the final else in SymbolDatabase::addNewFunction,
which sets tok to nullptr, effectively skipping to the end of the stream.
* fixup! Fix deleted functions, which skipped everything after
`a::b f() = delete` triggered the final else in SymbolDatabase::addNewFunction,
which sets tok to nullptr, effectively skipping to the end of the stream.
* Make it heard when encountering unexpected syntax/tokens
Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
* 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
* iwyu.yml: use debian:unstable to always get latest include-what-you-use
* cleaned up includes based on include-what-you-use
* mitigated include-what-you-use false positives