Commit Graph

1568 Commits

Author SHA1 Message Date
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
chrchr-github fb88883813
Fix #11576 FP comparePointers / FN cstyleCast when taking address (#4817)
* Fix FN cstyleCast when taking address

* Fix #11576 FP comparePointers with member variable

* Use getParentLifetime()

* Fix test case number
2023-02-23 17:27:47 +01:00
Oliver Stöneberg afd13ea11d
ValueFlow: some interface and namespace cleanups (#4746) 2023-01-28 10:20:47 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg bea6aec2b2
extracted `ValueFlow::Value` to `vfvalue.{cpp|h}` (#4642) 2023-01-26 22:23:22 +01:00
Oliver Stöneberg 25a6146ffa
checkother.cpp: removed stray `CheckUninitVar` object (#4699) 2023-01-18 17:10:35 +01:00
chrchr-github a2fea3d9b4
Fix #11083 FP knownConditionTrueFalse with reassigned pointer (#4717) 2023-01-18 16:57:22 +01:00
chrchr-github 7bbdc95f25
Fix #11473 FP constVariable / #11448 FP constParameter / #11188 FP danglingTempReference (#4680)
* 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
2023-01-11 22:04:06 +01:00
Oliver Stöneberg a09667a6d9
removed unused error messages (#4689) 2023-01-07 10:35:39 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
chrchr-github 7506b4ab52
Fix #11441 FP variableScope when lambda is used (#4660) 2022-12-20 14:50:31 +01:00
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator (#4653)
* Evaluate args before function call

* Fix tests

* Format

* Add test for 11227

* Format

* Fix known condition
2022-12-18 22:07:43 +01:00
chrchr-github b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) (#4647) 2022-12-18 16:52:04 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` (#4637)
* added missing filtering offiles in Visual Studio project

* extracted `FwdAnalysis` from `astutils.{cpp|h}`
2022-12-13 22:29:23 +01:00
chrchr-github 3f5054035d
Fix #11432 FP passedByValue for overriden function (#4632) 2022-12-12 21:52:58 +01:00
chrchr-github d5d7446433
Add cfg for std::scoped_lock, handle template arguments in checkMisusedScopedObject() (#4615) 2022-12-07 09:10:48 +01:00
gerboengels 3fdba645a6
Improve fix for #11383 FP selfAssignment: lambda capture (#4584) 2022-11-18 19:44:32 +01:00
chrchr-github 701d381895
Fix #11383 FP selfAssignment: lambda capture / #11380 FP operatorEqRetRefThis (#4581)
* Fix  #11383 FP selfAssignment: lambda capture /  #11380
FP operatorEqRetRefThis

* Format
2022-11-13 21:20:44 +01:00
chrchr-github d717e62ec3
Fix #11371 Detect assignment to temporary (#4571)
* Fix #11371 Detect assignment to temporary

* Use AST

* Warn if type definition is not seen
2022-11-01 11:46:42 +01:00
chrchr-github 7b9c99003b
Improve unreachableCodeError: handle library functions (#4560)
* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Revert "Update templatesimplifier.cpp"

This reverts commit 3fd152ed4063772a5f162bd985c3d91bcc65eb55.

* Revert "Add tests"

This reverts commit e760ab51e66a0a2c3a0250caf4cf3b745db44d10.

* Improve unreachableCodeError: handle library functions

* Fix merge
2022-10-20 07:00:36 +02:00
chrchr-github 9c7b4c9540
Improve unreachableCodeError message (#4559)
* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Revert "Update templatesimplifier.cpp"

This reverts commit 3fd152ed4063772a5f162bd985c3d91bcc65eb55.

* Revert "Add tests"

This reverts commit e760ab51e66a0a2c3a0250caf4cf3b745db44d10.
2022-10-19 19:19:31 +02:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
Oliver Stöneberg fa7e08a29f
optimized `CheckOther::checkDuplicateBranch()` a bit (#4542) 2022-10-09 20:48:54 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* 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 4d13266e99
Fix #10083 FN unusedScopedObject: temporary lock 'std::lock_guard<std::mutex>(m)' (#4522)
* Fix #10083 FN unusedScopedObject: temporary lock 'std::lock_guard<std::mutex>(m)'

* Format

* Fix cppcheck-cfg.rng

* Format
2022-09-30 07:25:33 +02:00
chrchr-github 2808fc615e
Fix #10057 "statement without effect" / #4779 FN unusedScopedObject does not work for classes in different namespace (#4500)
* Partial fix for #10057 unused variable without assignment not detected

* Add test for #9672

* Fix #4779 FN unusedScopedObject does not work for classes in different namespace

* Merge

* Fix #10057 "statement without effect" (unused variable without assignment) not detected

* Format
2022-09-24 12:49:37 +02:00
chrchr-github cb6f04a16c
Fix #11315 FP zerodivcond from enum definition / #11310 FP unassignedVariable with static variable (#4476)
* Fix #11315 FP zerodivcond from enum definition

* Simplify Boolean expression

* Fix #11310 FP unassignedVariable with static variable
2022-09-17 18:50:07 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* 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
2022-09-16 07:15:49 +02:00
chrchr-github d1386a842a
Fix #11301 debug: constStatementError not handled. (#4463)
* Fix #11301 debug: constStatementError not handled.

* Use function
2022-09-14 23:57:02 +02:00
Paul Fultz II 43caa32abf
Fix 9755: false negative: access of moved variable in conditional code (#4459)
* Fix 9755: false negative: access of moved variable in conditional code

* Format
2022-09-11 12:32:01 +02:00
Oliver Stöneberg d73a33d17e
avoid redundant `Token::declEndToken()` calls (#4363) 2022-08-20 20:50:14 +02:00
Oliver Stöneberg 16f598c409
added missing `sstream` includes (#4381) 2022-08-19 10:16:23 +02:00
chrchr-github 4a64e20592
unusedScopedObject: Don't warn for void statements (#4370)
* Fix unusedScopedObject FPs

* Simplify

* Simplify

* Fix test

* Don't warn for void statements

* Format
2022-08-17 19:45:46 +02:00
chrchr-github 1a95515e47
Fix unusedScopedObject FPs (#4364) 2022-08-17 09:11:23 +02:00
chrchr-github 3dc2c0bd42
Fix #11257 FN constStatement with misused comma (#4365) 2022-08-16 22:10:58 +02:00
chrchr-github afef71f6b6
Partial fix for #10057 unused variable without assignment not detected (#4348)
* Partial fix for #10057 unused variable without assignment not detected

* Add test for #9672
2022-08-13 08:29:06 +02:00
chrchr-github a62c3ea90e
Fix #11234 Broken AST with auto**, FP constStatement (#4339) 2022-08-03 19:03:38 +02:00
Oliver Stöneberg efaaa58896
fixed some `modernize-use-emplace` false negatives and some `bugprone-assignment-in-if-condition` warnings (#4311) 2022-07-28 22:53:59 +02:00
chrchr-github 109a031ec7
Fix #11195 Add redundantContinue check (#4283) 2022-07-16 16:02:58 +02:00
PKEuS f3565e1056
Improvement: Support member variables in CheckOther::checkIncompleteArrayFill() (#4205)
Merged from LCppC.
2022-07-12 19:43:48 +02:00
chrchr-github f5c4a21eae
Fix #10704 FN redundantCopyLocalConst (#4115) 2022-07-10 11:33:24 +02:00
Oliver Stöneberg c9c1f83a69
use `emptyString` more consistently (#4034) 2022-07-10 10:57:29 +02:00
Oliver Stöneberg b51aea5531
separated process execution code into `ProcessExecutor` (#4249) 2022-07-08 16:42:57 +02:00
chrchr-github 2223cd24b9
Fix #11157 FN: leakNoVarFunctionCall (switch condition) (#4240)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )

* #11155 FN: leakNoVarFunctionCall (ternary operator)

* Fix #11157 FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

* Fix FP leakNoVarFunctionCall
2022-06-28 14:02:02 +02:00
chrchr-github 242afc389d
Fix #11148 Regression: Parameter \'ptr\' can be declared as pointer to const (#4233) 2022-06-25 21:42:55 +02:00
chrchr-github f1212e66f7
Fix FP constVariable with 2D array. (#4228)
Test case #8717 was actually a FP as well.
2022-06-22 21:22:04 +02:00
PKEuS 9eb16e1002
Replaced check for pipe() buffer size by ordinary CheckBufferOverrun, provide required Library configuration option (#4183)
Merged from LCppC.
2022-06-19 12:01:55 +02:00
chrchr-github ecb24e28bc
Fix #10191 FP redundantCopyLocalConst - referenced variable changes (#4202) 2022-06-11 16:58:33 +02:00
chrchr-github 8579feb3aa
Fix #10545 FP redundantCopyLocalConst with modified object [inconclusive] (#4197)
* Fix  #10545 FP redundantCopyLocalConst with modified object [inconclusive]

* Comment
2022-06-11 11:01:23 +02:00
PKEuS 1275b5275e
LCppC backport: Various optimizations (#4182)
* Optimization: Use Token::eIncDecOp instead of expensive Token::Match calls

Merged from LCppC.

* Small Optimizations: - Moved a std::set that is only need during initialization of SymbolDatabase to function scope - Use std::vector instead of std::list

Merged from LCppC.

* Optimization: Refactorized various Token::Match calls and surrounding conditions

Merged from LCppC.

* Refactorization: Cleanup usage of std::multimap

Merged from LCppC.
2022-06-08 16:58:57 +02:00