Commit Graph

1368 Commits

Author SHA1 Message Date
Oliver Stöneberg 3cf9100198
fixed #6316 (Use std::to_string() in place of MathLib::toString() ...) - deleted default implementation of `Mathlib::toString()` (#5341)
It was also used inconsistently and seemed to imply there is some
special handling which wasn't the case. It was just an alias for
`std::to_string()` for non-`double` types. So there was no need for it.

---------

Co-authored-by: Robert Reif <reif@earthlink.net>
2023-08-17 16:46:32 +02:00
Oliver Stöneberg d8b44dff56
fixed/suppressed several compiler warnings (#5327) 2023-08-16 19:35:53 +02:00
chrchr-github c3d7c91e88
Additional call to setValueTypeInTokenList() (#5300) 2023-08-08 22:54:27 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
chrchr-github 610777d586
Set enum ValueType for :: (#5298) 2023-08-07 21:40:33 +02:00
chrchr-github 73251544a4
Fix #11842 FN constParameterPointer with library function (#5257) 2023-08-05 18:48:43 +02:00
Oliver Stöneberg 45de338f1b
cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
2023-08-02 10:36:17 +02:00
Paul Fultz II 389e446dc0
Fix 11848: Assert failure in getParentValueTypes() (#5274) 2023-08-02 10:29:19 +02:00
chrchr-github 2cf4b3a6f3
Fix functionConst TODO (#5261) 2023-07-24 16:26:23 +02:00
chrchr-github c0bd9f8bbd
Fix #11827 FP duplInheritedMember - different return type (#5231) 2023-07-12 15:56:07 +02:00
chrchr-github db49687ae5
Fix getOverriddenFunction(), add test (#5213) 2023-07-01 17:23:26 +02:00
chrchr-github b99931c59c
Fix #11808 FP uselessOverride - grandchildren calling grandfather (#5212) 2023-07-01 14:11:28 +02:00
chrchr-github 9b892f3239
Partial fix for #11552 Handle lambda return types (#5188) 2023-06-25 12:01:59 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
chrchr-github 53cab34484
Fix #11769 cppcheckError for function with lambda as default parameter (#5159) 2023-06-17 17:03:19 +02:00
chrchr-github 901b775471
Fix scope for function returning rvalue reference, insert std:: in return statement (#5119)
* Fix scope for function returning rvalue reference

* Insert std:: in return statement

* Fix failing test
2023-06-08 07:47:21 +02:00
chrchr-github 39f958bcfb
Fix #11596 FP uninitvar with array of function pointers (#5098) 2023-06-07 11:41:22 +02:00
chrchr-github ac86eda6b3
Revert "Revert "Skip forwarding values for unique expressions (#5103)"" (#5124) 2023-06-07 11:11:48 +02:00
Daniel Marjamäki 7d4472616b Revert "Skip forwarding values for unique expressions (#5103)"
This reverts commit 26ed052e8d.
2023-06-06 17:31:24 +02:00
Paul Fultz II 26ed052e8d
Skip forwarding values for unique expressions (#5103) 2023-06-05 20:49:19 +02:00
chrchr-github 1b98be458d
Fix #11739 Assert failure in valueflow.cpp / setSymbolic() (#5104) 2023-06-03 11:08:06 +02:00
chrchr-github a91222fad8
Partial fix for #11637 FN functionConst (#5102)
* Partial fix for #11637 FN functionConst

* Redundant check
2023-05-31 20:55:12 +02:00
chrchr-github 17789778c9
Fix #11547 FN stlcstrParam with std::string_view (#5093)
* Fix #11547 FN stlcstrParam with std::string_view

* Add suppression

* Use emplace()
2023-05-28 01:11:11 +02:00
Daniel Marjamäki 107eea236f
Improved handling of alignas. alignas will not be removed from now on so we don't loose this information. (#5081) 2023-05-24 10:33:53 +02:00
chrchr-github 8eabf5c211
Fix #8433 FN unused variable not detected when there is lambda (#5060)
* Fix #8433 FN unused variable not detected when there is lambda

* Format

* Fix tests

* Check lambda return

* Add test

* Undo, add test

* simpleMatch()

* Rename test
2023-05-22 07:39:57 +02:00
chrchr-github 518b6a27ab
Fix #11719 Handle lambdas in global scope (#5065)
* Fix #11719 Handle lambdas in global scope

* Capture list
2023-05-17 14:37:56 +02:00
Paul Fultz II 543b4adc8a
Fix 11682: False positive: constParameterReference with overloaded method (#5038)
* Fix 11682: False positive: constParameterReference with overloaded method

* Format
2023-05-05 11:27:15 +02:00
chrchr-github 7e0ddd3669
Set function pointer for ::f (#5028) 2023-05-02 22:53:21 +02:00
Paul Fultz II 9d21379c7d
Add non-const overloads for next(), previous(), and link() (#5002)
* Add non-const overloads for next(), previous(), and link()

* Format

* Add CPPCHECKLIB
2023-05-02 06:55:31 +02:00
Oliver Stöneberg b3016f01a1
fixed some CLion inspection warnings (#4688)
* fixed some CLion "Unused global declaration" warnings

* fixed some CLion "Not implemented function" warnings

* fixed some CLion "Unused struct" warnings

* added TODO

* removed unused parameter reported by CLion

* fixed some CLion "Unused macro" warnings

* fixed some CLion "Condition is always true" warnings and a CLion "The value is never used" warning
2023-04-28 16:02:41 +02:00
Oliver Stöneberg 1cd1cbabe9
avoid some unnecessary code execution (#4962) 2023-04-28 12:42:51 +02:00
Oliver Stöneberg 0924e6616e
made some member functions static (#4966) 2023-04-28 12:29:40 +02:00
chrchr-github 96cf2b34fd
Optimize createSymbolDatabaseExprIds() (#5017) 2023-04-27 22:06:06 +02:00
chrchr-github 023e79b6c2
Fix #11459 uninitvar false positive (#5011)
* Fix #11459 uninitvar false positive

* Format
2023-04-25 21:01:44 +02:00
chrchr-github c5310fe8a2
Fix #8592 SymbolDatabase: better handling of 'using namespace' (#4974) 2023-04-22 10:23:12 +02:00
chrchr-github 5a4e43760e
Handle auto * const (#4994)
* Handle auto as first token

* Set varid when initialized by function

* Fix TODO from #11444

* Fix function parsing

* Add parentheses

* Format

* Handle auto * const

* Fix test on different platforms

* simpleMatch

* simpleMatch
2023-04-21 14:19:28 +02:00
chrchr-github a4e224b65c
Handle auto as first token, set varid (#4991)
* Handle auto as first token

* Set varid when initialized by function

* Fix TODO from #11444

* Fix function parsing

* Add parentheses

* Format
2023-04-21 10:13:25 +02:00
chrchr-github 31e714cded
Fix incorrect function assignment (#4977) 2023-04-19 06:53:47 +02:00
chrchr-github 87755e3bae
Fix autoNoType with function returning container, rvalue reference (#4926) 2023-04-12 22:10:10 +02:00
Daniel Marjamäki afb9e43f2a dump: write container information 2023-04-12 21:57:37 +02:00
chrchr-github a336048d14
Fix #11599 false negative: constParameter (#4902)
* Partial fix for #11599 false negative: constParameter

* Adjust test

* Update testother.cpp

* Update testother.cpp

* Fix #11599 false negative: constParameter

* Fix new warnings

* Format

* Add difference_type

* Remove isAliased()

* Undo

* Adjust test

* Add test

* Improve const check

* Tweak constness, add tests

* Add tests

* Use new helper function, fixtest

* Remove bailout, fix check for cast

* Prevent FP

* Fix constVariable check, add tests

* Format

* Format

* Add test for #11632
2023-04-02 20:36:23 +02:00
chrchr-github 01a22159b8
Fix autoNoType with std::begin() / function returning smart ptr (#4919)
* Fix autoNoType with std::begin()

* Suppress warning for const lambda

* Fix autoNoType with function returning smart ptr

* Handle more complex expression

* Fix scope with auto and smart ptr

* Handle smart pointers and iterators first
2023-04-01 09:38:40 +02:00
chrchr-github 5791561a45
Partial fix for #11543 checkLibraryFunction warning for smartpointer in container (#4900) 2023-03-27 17:50:33 +02:00
Daniel Marjamäki c79d859f8b Tokenizer::simplifyTypedef: new faster simplification.
It performs a more "lightweight" simplification of global typedefs that are not shadowed.

If a "heavy" simplification is needed that will be executed afterwards.
2023-03-26 17:16:45 +02:00
Paul Fultz II 7231d1cece
Update the isVariableChanged to correctly check the const bit (#4912) 2023-03-26 15:12:49 +02:00
Paul Fultz II fd8a7b9537
ValueFlow: Evaluate if statement for function returns (#4908) 2023-03-24 13:31:26 +01:00
chrchr-github 6316479782
Fix FP unusedStructMember with std::map (#4899) 2023-03-20 19:40:57 +01:00
chrchr-github 3b61ecd973
Fix FP missingOverride (#4894) 2023-03-18 16:39:45 +01:00
chrchr-github 3ccd0505cd
Enable and mitigate readability-simplify-boolean-expr (#4897) 2023-03-17 13:51:55 +01:00
chrchr-github 322a1a5e8c
Partial fix for #11378 internalAstError regressions (iscpp11init) (#4889) 2023-03-13 16:30:27 +01:00
Paul Fultz II 61e8b84578
Fix 11610: false negative: knownConditionTrueFalse with address of variable (#4883) 2023-03-12 19:57:11 +01:00
chrchr-github e2b2fc2684
Fix #10946 Debug warning: autoNoType with lambda (#4824) 2023-03-12 15:48:20 +01:00
chrchr-github 7881b99547
Fix #10259 debug: SymbolDatabase couldn't resolve all user defined types (#4879) 2023-03-10 19:04:46 +01:00
chrchr-github 49c5a5aabd
Fix #11602 "debug: Executable scope 'x' with unknown function" (#4869) 2023-03-09 20:04:55 +01:00
Mateusz Michalak 2d5cabed4b
Add std::*begin and std::*end cfg (#4796) 2023-03-09 17:06:53 +01:00
Paul Fultz II 9351eddbca
Fix 11605: FN useStlAlgo with multiple conditions (#4873) 2023-03-09 17:06:27 +01:00
Oliver Stöneberg 20db3ff368
SymbolDatabase: made `mTokenizer` and `mSettings` references (#4857) 2023-03-07 12:22:06 +01:00
Oliver Stöneberg 50eb0641b9
iwyu.yml: added `clang-include-cleaner` job / cleaned up includes based on `include-what-you-use` (#4844) 2023-03-04 08:53:19 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg b70e1d5461
avoid some unchecked pointer dereferences (#4811) 2023-03-02 22:05:41 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
Oliver Stöneberg 75619db1d5
symboldatabase.cpp: use `Keywords` / added TODOs (#4828) 2023-03-02 21:20:56 +01:00
chrchr-github 072e822020
Set ValueType for free function returning iterator (#4837) 2023-03-02 21:01:20 +01:00
Daniel Marjamäki 80050b11dd SymbolDatabase: Fix handling of function pointer arguments 2023-02-27 15:10:25 +01:00
chrchr-github 29b651f264
Partial fix for #11543 checkLibraryFunction warning for smartpointer in container (#4781) 2023-02-25 15:47:02 +01:00
Oliver Stöneberg a250e6b569
enabled and mitigated `-Wunreachable-code` Clang warnings (#4818) 2023-02-24 21:57:44 +01:00
chrchr-github 92b42255da
Fix #11559 FN functionConst (#4795) 2023-02-24 21:44:57 +01:00
chrchr-github d65cc696b0
Get type from auto with scope (#4822) 2023-02-24 21:05:26 +01:00
chrchr-github a030970160
Fix #11531 FP constParameter with const/non-const overload / #8700 FP functionConst (#4802) 2023-02-24 07:05:18 +01:00
Daniel Marjamäki e5a22e3436 Revert "improved `Path` handling of mixed separators (#4808)"
This reverts commit 0797867758.
2023-02-24 06:21:02 +01:00
Oliver Stöneberg 0797867758
improved `Path` handling of mixed separators (#4808) 2023-02-23 22:34:05 +01:00
chrchr-github 1c11d3039d
Fix FP returnTempReference (#4793)
* Fix FP returnTempReference

* Fix mismatch between token and variable ValueType

* Format, clang-tidy

* Add test

* Format
2023-02-17 07:17:37 +01:00
Oliver Stöneberg 8ef14dad98
fixed and enabled `performance-faster-string-find` clang-tidy warning (#4769) 2023-02-08 21:01:51 +01:00
chrchr-github 271ccbc8f3
Fix FP constVariable with reference to std::array (#4777) 2023-02-08 08:25:43 +01:00
chrchr-github 55292d476a
Fix #11535 "debug: Executable scope 'x' with unknown function" (#4770) 2023-02-07 22:35:58 +01:00
chrchr-github c3225781f3
Fix #11533 Infinite recursion in typeDecl() (#4767) 2023-02-07 22:02:59 +01:00
chrchr-github 8af1026696
Set functions for calls through iterators (#4763) 2023-02-07 21:57:59 +01:00
chrchr-github d06f93aebf
Fix #11458 nullPointer false positive (#4758) 2023-02-06 22:06:04 +01:00
chrchr-github a666e31801
Fix #11517 FP constVariable with dynamic_cast (#4753) 2023-02-06 22:05:07 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
chrchr-github 3ccc0adbca
Fix #11182 checkLibraryFunction with overloaded method / #11198 inconsistent reporting of checkLibraryNoReturn (#4740) 2023-01-26 22:29:49 +01:00
chrchr-github b5a06d045e
Fix #11497 debug: CheckClass::isMemberVar found used member variable 'x' with varid 0 (inconclusive) (#4736) 2023-01-26 22:19:51 +01:00
chrchr-github a0f51d1e21
Improve <type-checks><unusedvar> error message (#4735) 2023-01-26 22:18:55 +01:00
chrchr-github 3a8d9b8c87
Fix #11510 FP CastIntegerToAddressAtReturn with ternary operator (#4732) 2023-01-26 22:09:55 +01:00
chrchr-github 50d297b309
Enable useStlAlgorithm in selfcheck (#4725) 2023-01-17 20:48:26 +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
chrchr-github 4c1c506d21
#11472 FP returnTempReference with cast and scope operator (#4676) 2023-01-02 22:13:56 +01:00
chrchr-github f793b7dd35
Fix #11460 unintvar false positive (#4674)
* Fix #11460 unintvar false positive

* Format
2023-01-02 17:44:52 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
chrchr-github ad858e92dc
Partial fix for #11444 cppcheckError: Analysis failed (function not recognized) (#4656) 2022-12-19 22:29:43 +01:00
chrchr-github 76c28073aa
Revert fix for #10831 (#4631) 2022-12-18 16:55:55 +01:00
gerboengels 63e30d1b8c
Fix syntaxError on lambda inside decltype (#4650)
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
Paul Fultz II 90898945c1
Fix 10532: False negative: dangling string_view when using ternary operator (#4638)
* Fix 10532: False negative: dangling string_view when using ternary operator

* Format

* Update
2022-12-15 18:34:43 +01:00
chrchr-github 665e4230f2
Fix #11406 FP returnDanglingLifetime, std::unique_ptr and implicit conversion to bool (#4600) 2022-11-27 09:24:19 +01:00
chrchr-github 4ce76d0b58
Fix #11385 debug: SymbolDatabase::findFunction found '>' without link. (#4583) 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 #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00