Commit Graph

634 Commits

Author SHA1 Message Date
Oliver Stöneberg 132a5a31cf
improved setting of platform in tests / also improved platform tests ()
* fixture.h: added TODO

* TestPlatform: improved tests for built-in platforms

* TestPlatform: changed tests to TODO asserts

* testfilelister.cpp: added TODO

* fixture.h: added `PLATFORM` macro to load platform / use `PLATFORM` in tests

* platform.h: corrected capitalization in `Platform::platformString(PlatformType)` and bail on unknown type

* fixture.h: fixed `readability-redundant-string-cstr` clang-tidy warning

* testplatform.cpp: fixed `functionConst` selfcheck warnings
2023-02-11 10:44:56 +01:00
chrchr-github 55292d476a
Fix "debug: Executable scope 'x' with unknown function" () 2023-02-07 22:35:58 +01:00
chrchr-github 8af1026696
Set functions for calls through iterators () 2023-02-07 21:57:59 +01:00
chrchr-github a666e31801
Fix FP constVariable with dynamic_cast () 2023-02-06 22:05:07 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1d3955bd92
renamed some files in the `test` folder () 2023-01-27 08:18:32 +01:00
chrchr-github 3ccc0adbca
Fix checkLibraryFunction with overloaded method / inconsistent reporting of checkLibraryNoReturn () 2023-01-26 22:29:49 +01:00
chrchr-github 7bbdc95f25
Fix FP constVariable / FP constParameter / FP danglingTempReference ()
* Fix  FP constVariable with range-based for /  FP constParameter with unused non-const range loop variable

* Fix ValueType /  FP danglingTempReference with auto

* Fix ValueType in range-based for

* Update symboldatabase.cpp
2023-01-11 22:04:06 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible () 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops () 2022-12-20 20:32:16 +01:00
chrchr-github ad858e92dc
Partial fix for cppcheckError: Analysis failed (function not recognized) () 2022-12-19 22:29:43 +01:00
gerboengels 63e30d1b8c
Fix syntaxError on lambda inside decltype ()
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>
2022-12-18 16:46:04 +01:00
chrchr-github 4ce76d0b58
Fix debug: SymbolDatabase::findFunction found '>' without link. () 2022-11-14 21:08:15 +01:00
Daniel Marjamäki 8fb8e06003 SymbolDatabase: Set valuetype for this 2022-11-12 22:23:42 +01:00
Daniel Marjamäki e45e5f9f15 SymbolDatabase: fix ValueType for '&array[x]' 2022-11-05 21:22:08 +01:00
Daniel Marjamäki ecb2938e7e SymbolDatabase: Set correct ValueType when there is array-to-pointer decay 2022-11-05 17:38:31 +01:00
chrchr-github 3273e51fd5
Fix FN useStlAlgorithm with iterators () 2022-10-16 13:46:26 +02:00
Daniel Marjamäki 2a81388c95 Fixed (False positive: unreadVariable when union in derived struct is used) 2022-10-11 20:47:07 +02:00
gerboengels ed06e29f7a
Fix defaulted and deleted functions ()
* 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>
2022-10-10 20:17:33 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references ()
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
chrchr-github 64f3f85804
Fix Function::addArguments found argument 'b' with varid 0 wit… ()
* Fix  Function::addArguments found argument 'b' with varid 0 with lambda parameter

* Fix varid0 warning
2022-09-26 18:21:21 +02:00
Daniel Marjamäki 92845295b8 Fix broken CI caused by my qt fix 2022-09-08 11:12:38 +02:00
chrchr-github 7156afe003
Fix FN (error) buffer access out of bounds - known argument ()
* Fix  FN (error) buffer access out of bounds - known argument const char* argv[]

* Format
2022-08-26 17:27:54 +02:00
chrchr-github 974e34490f
Fix FP Unused private function () 2022-08-07 20:06:32 +02:00
chrchr-github 457a0cff87
Fix FP unusedStructMember when used through iterator (regression) ()
* Format

* Fix  FP unusedStructMember when used through iterator (regression)

* Format

* Fix test

* Format

* Nullptr check
2022-07-19 20:42:54 +02:00
chrchr-github bd92e7411c
Fix Hang on smart pointer with auto type deduction ()
* Fix  Hang on smart pointer with auto type deduction

* Format

* Format
2022-07-08 12:37:53 +02:00
chrchr-github 90392faa2b
Fix crash on nullptr deref () 2022-06-09 18:25:17 +02:00
PKEuS 898a3a25a1
ValueType: Added additional unit test ()
Removed unnecessary library export

Backported from LCppC.
2022-06-08 15:27:56 +02:00
chrchr-github e6f2929fac
Fix FN constVariable with range-based for () 2022-06-03 19:24:59 +02:00
chrchr-github 2ceaf308de
Fix : ValueType for pointer typedef, don't warn for typedef'd pointers, improve error message ()
* Fix ValueType for pointer typedef

* Add test

* Don't warn for typedef'd pointers, improve error message

* Fix tests

* Add TODO

* Fix test

* Set isSimplifiedTypedef() for more tokens, add test

* Add test
2022-05-24 10:09:48 +02:00
chrchr-github 2b723eafcb
Fix ValueType for references in range-based for loop ()
* Fix ValueType for references in range-based for loop

* Format
2022-05-20 08:48:01 +02:00
chrchr-github 6b5df68677
Fix syntaxError for valid C code sizeof(enum ...) () 2022-04-26 07:22:53 +02:00
Oliver Stöneberg 45158ec064
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() () 2022-04-09 19:02:37 +02:00
chrchr-github 38bc0ad4c3
Fix regression: wrong member variable () 2022-04-08 08:23:10 +02:00
chrchr-github 4c375e7224
Fix FP redundantInitialization with lambda / debug: valueFlowConditionExpressions bailout ()
* Fix  FP redundantInitialization with lambda

* Fix  debug: valueFlowConditionExpressions bailout

* Format
2022-04-05 23:19:17 +02:00
chrchr-github c4dcfef385
Fix debug: Executable scope 'x' with unknown function. ()
* Fix  debug: Executable scope 'x' with unknown function

* Format

* Add test for 

* Fix  debug: Executable scope 'x' with unknown function.
2022-04-05 15:52:16 +02:00
chrchr-github 3ba6914563
Add test for ()
* Fix  debug: Executable scope 'x' with unknown function

* Format

* Add test for 
2022-04-05 13:04:20 +02:00
chrchr-github b79885c6af
Fix debug: Executable scope 'x' with unknown function ()
* Fix  debug: Executable scope 'x' with unknown function

* Format
2022-04-05 07:34:06 +02:00
Paul Fultz II 5bea50cd36
Fix 10908: FP: uninitvar after for-loop () 2022-03-31 21:24:20 +02:00
chrchr-github 6376bac5bb
Fix syntaxError with typedef and lambda ()
* Fix  syntaxError with typedef and lambda

* Don't insert union into template argument list, add test

* Format

* Revert "Format"

This reverts commit 8c52d49c8b.

* Format
2022-03-14 17:59:29 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly () 2022-02-10 23:02:24 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use () 2022-01-27 19:03:20 +01:00
Paul Fultz II 4af98f21d6
Fix 10588: crash () 2022-01-16 12:33:31 +01:00
Paul Fultz II 55ff010df3
Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList ()
* Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList

* Format
2022-01-15 07:56:56 +01:00
shaneasd 8f7996211b
remove nullScope from TestSymbolDatabase () 2022-01-06 15:23:43 +01:00
Daniel Marjamäki e6ccf299b9 Fixed (SymbolDatabase: final class is not parsed properly) 2021-12-22 21:48:01 +01:00
Daniel Marjamäki 77434d093e SymbolDatabase: Do not set wrong type for std::map etc items in range for loop 2021-12-11 15:16:54 +01:00
chrchr-github ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code () 2021-11-29 07:34:39 +01:00