Commit Graph

426 Commits

Author SHA1 Message Date
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return () 2023-06-20 18:43:21 +02:00
chrchr-github 901b775471
Fix scope for function returning rvalue reference, insert std:: in return statement ()
* 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 647432580f
Fix FN functionConst when using base class members ()
* Fix  FN functionConst when using base class members

* Format

* Add const

* Add const

* Improve const check for arguments, comments, tests

* Add test for 

* Add test for 

* Fix merge

* Add tests

* Use ASSERT_EQUALS

* Redundant check
2023-05-28 01:11:59 +02:00
chrchr-github 17789778c9
Fix FN stlcstrParam with std::string_view ()
* Fix  FN stlcstrParam with std::string_view

* Add suppression

* Use emplace()
2023-05-28 01:11:11 +02:00
Paul Fultz II 9d21379c7d
Add non-const overloads for next(), previous(), and link() ()
* 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 ()
* 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 0924e6616e
made some member functions static () 2023-04-28 12:29:40 +02:00
Oliver Stöneberg 5be8eee943
iwyu.yml: use a distro which has the latest `include-what-you-use` / enabled Qt mappings / cleaned up includes () 2023-04-08 16:08:47 +02:00
chrchr-github a336048d14
Fix false negative: constParameter ()
* Partial fix for  false negative: constParameter

* Adjust test

* Update testother.cpp

* Update testother.cpp

* Fix  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 
2023-04-02 20:36:23 +02:00
chrchr-github 7bf6b359b1
Fix false negative: functionConst () 2023-03-27 17:54:19 +02:00
Paul Fultz II 7231d1cece
Update the isVariableChanged to correctly check the const bit () 2023-03-26 15:12:49 +02:00
chrchr-github 3ccd0505cd
Enable and mitigate readability-simplify-boolean-expr () 2023-03-17 13:51:55 +01:00
chrchr-github 9ed21fb917
Fix FN functionConst with comparison as argument () 2023-03-12 11:39:18 +01:00
Oliver Stöneberg 20db3ff368
SymbolDatabase: made `mTokenizer` and `mSettings` references () 2023-03-07 12:22:06 +01:00
Oliver Stöneberg b70e1d5461
avoid some unchecked pointer dereferences () 2023-03-02 22:05:41 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` () 2023-03-02 21:50:14 +01:00
Oliver Stöneberg 8583fcf96e
avoid more cases of returning non-const pointers from `const` objects () 2023-02-24 21:22:08 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible () 2022-12-30 15:13:47 +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 665e4230f2
Fix FP returnDanglingLifetime, std::unique_ptr and implicit conversion to bool () 2022-11-27 09:24:19 +01:00
chrchr-github 3273e51fd5
Fix FN useStlAlgorithm with iterators () 2022-10-16 13:46:26 +02:00
Oliver Stöneberg 897826006e
mitigated some clang-tidy warnings in headers ()
* erroritem.h: avoid `performance-no-int-to-ptr` clang-tidy warning

* suppress `readability-inconsistent-declaration-parameter-name` clang-tidy warnings for Qt signals

* tokenlist.h: mitigated `readability-make-member-function-const` clang-tidy warnings

* fixed `modernize-use-override` clang-tidy warnings in headers

* fixed `modernize-pass-by-value` clang-tidy warnings in headers

* tokenize.cpp: avoid unnecessary copy
2022-09-16 18:59:15 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` () 2022-09-08 09:21:35 +02:00
PKEuS d81a758850
LCppC backports: Refactorizations/Optimizations () 2022-08-21 17:21:02 +02:00
Oliver Stöneberg 0e1cd8b2ac
do not do C++ processing for C code in `parsedecl()` () 2022-08-21 17:11:22 +02:00
Oliver Stöneberg 4bf5dcd29f
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* testlibrary.cpp: no need for `empyString` optimization
2022-08-14 12:44:19 +02:00
Oliver Stöneberg 887463855b
mitigated most clang-tidy warnings in headers () 2022-07-26 11:10:03 +02:00
Oliver Stöneberg b2f15fdbb1
reduced padding in some classes/structs () 2022-07-24 10:17:11 +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
Armin Müller 0ae9877766
Typos found by running "codespell" () 2022-07-10 22:40:05 +02:00
chrchr-github f5c4a21eae
Fix FN redundantCopyLocalConst () 2022-07-10 11:33:24 +02:00
Paul Fultz II 46fcdca5ee
Add debug_valuetype intrinsic () 2022-06-15 21:25:55 +02:00
PKEuS 1275b5275e
LCppC backport: Various optimizations ()
* 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
chrchr-github 1d677c57a8
Fix FN: noExplicitConstructor with single default parameter () 2022-06-07 21:15:13 +02:00
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member ()
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +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
Paul Fultz II 4b4037540a
valueFlowUninit: Handle arrays and pod types ()
* valueFlowUninit: Handle arrays and pod types

* Format

* Catch another array case
2022-03-24 06:35:44 +01:00
chrchr-github 4c85ac0d7b
Fix FP unused struct member (inner struct in C code) ()
* Fix  FP unused struct member (inner struct in C code)

* Redundant findType() call, add test
2022-03-12 06:16:29 +01:00
Oliver Stöneberg 4a63af02ed
enabled functionConst and functionStatic in selfcheck ()
* 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
2022-03-02 07:46:47 +01:00
chrchr-github edc5106237
Fix FN missingOverride - subclass in namespace () 2022-02-12 08:19:07 +01:00
Oliver Stöneberg 6e57cc4323
small utils.h cleanup () 2022-02-11 19:44:08 +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
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings () 2022-01-04 15:48:08 +01:00
Oliver Stöneberg 6739995e79
removed or annotated some code which is only used in test code () 2022-01-03 12:40:20 +01:00
Oliver Stöneberg ba402f3e50
cleaned up includes based on include-what-you-use () 2021-12-15 19:47:27 +01:00
Paul Fultz II 13f5b560ce
Fix 10555: FP knownConditionTrueFalse with non-const function in base class () 2021-11-12 20:05:43 +01:00
chrchr-github 629f883408
Fix : autovarInvalidDeallocation with pointer to std::array () 2021-11-08 20:31:16 +01:00
Ken-Patrick Lehrmann b3b3b6b2a1
Fix handling of namespace scope with several bodystarts ()
Follow up to 0093452bed.
Give the proper end to getVariableList, since it might not be bodyEnd.

Before that, getVariableList would add the same variables in several
unrelated scopes, and all kind of false positive would follow.

For instance, with the case I added in the unit-tests, I had:
```
../code.cpp:15:18: warning: The struct 'is_A' defines member variable with name 'foo' also defined in its parent struct 'is_A_impl'. [duplInheritedMember]
static const int foo = 8;
                 ^
../code.cpp:15:18: note: Parent variable 'is_A_impl::foo'
static const int foo = 8;
                 ^
../code.cpp:15:18: note: Derived variable 'is_A::foo'
static const int foo = 8;
                 ^
../code.cpp:15:18: style: struct member 'has_A::foo' is never used. [unusedStructMember]
static const int foo = 8;
                 ^
../code.cpp:15:18: style: struct member 'is_A::foo' is never used. [unusedStructMember]
static const int foo = 8;
                 ^
```
2021-09-04 11:09:33 +02:00