chrchr-github
b12aebc817
Fix #9353 FN (style) Condition '...' is always true, add test for #10508 ( #4731 )
2023-01-26 22:03:12 +01:00
chrchr-github
3076f9def1
Fix #11449 Function call not recognized with extra parentheses / FP nullPointer ( #4703 )
2023-01-18 20:38:37 +01:00
chrchr-github
0b62c73ff0
Fix spurious variable declaration with unknown macro and using ( #4698 )
2023-01-18 17:11:41 +01:00
chrchr-github
9cf934c10d
Improve handling of 'final' in class declaration ( #4706 )
2023-01-18 17:08:43 +01:00
Armin Müller
a77f0d9403
Typos found by running "codespell" ( #4702 )
2023-01-10 15:15:27 +01:00
chrchr-github
491721a6ff
Fix spurious variable declaration with unknown macro ( #4694 )
2023-01-09 16:11:26 +01:00
Oliver Stöneberg
d3a2cdc26c
converted (undocumented) define `MAXTIME` into (undocumented) command-line options `--checks-max-time=`, `--template-max-time=` and `--typedef-max-time=` ( #4661 )
2022-12-30 21:21:05 +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
5b687cb038
Fix #11423 Crash in valueFlowForwardConst() ( #4634 )
2022-12-12 22:58:48 +01:00
chrchr-github
c779cefa61
Fix #11422 debug: Missing variable class for variable with varid ( #4616 )
2022-12-08 20:17:06 +01:00
chrchr-github
428f5016d4
Partial fix for #11378 (iscpp11init) ( #4595 )
...
* Partial fix for #11378 (iscpp11init)
* Improve fix
* Add fix
2022-11-27 09:26:46 +01:00
Stefan van Kessel
a5c16af16d
Fix lambda capture template syntax error ( #4593 )
2022-11-23 20:15:10 +01:00
chrchr-github
ffc0c57562
Fix crashes on nullptr ( #4575 )
2022-11-09 21:56:16 +01:00
chrchr-github
e4c5f36af0
Fix #11373 typedef: not simplified after inline keyword ( #4574 )
2022-11-02 15:15:33 +01:00
chrchr-github
ae16aab997
Handle simple typedefs ( #4558 )
2022-10-22 00:28:05 +02:00
chrchr-github
515369739c
Fix #11359 FP constStatement for function-local struct definition+initialization statement ( #4561 )
2022-10-22 00:27:19 +02:00
chrchr-github
192c30ab1d
Fix crash in arraySize() ( #4556 )
...
* Fix #11355 FN: arrayIndexOutOfBounds
* Fix
* Fix crash in arraySize()
2022-10-19 19:19:01 +02:00
chrchr-github
5a8e55c083
Fix #11355 FN: arrayIndexOutOfBounds ( #4555 )
...
* Fix #11355 FN: arrayIndexOutOfBounds
* Fix
2022-10-18 07:24:24 +02:00
gerboengels
221873e69f
Fix #11319 ( #4549 )
...
In this example:
```
//template<std::same_as<int> T> // <= works
template<same_as<int> T> // <= didn't work
void f()
{}
```
the changed line used to match to `< same_as <`, therefore skip creating links.
The `%op% %name% <` already feels a bit like a workaround. So adding the condition that $op$ shouldn't be a comparison operator, but part of the template, seemed reasonable to me
Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-10-16 19:33:44 +02:00
chrchr-github
3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators ( #4157 )
2022-10-16 13:46:26 +02:00
Oliver Stöneberg
7ead32f96e
various optimizations ( #4535 )
...
* 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
2022-10-06 20:12:07 +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
64f3f85804
Fix #11332 Function::addArguments found argument 'b' with varid 0 wit… ( #4506 )
...
* Fix #11332 Function::addArguments found argument 'b' with varid 0 with lambda parameter
* Fix varid0 warning
2022-09-26 18:21:21 +02:00
chrchr-github
3b07661fd3
Fix #11293 debug: CheckClass::isMemberVar found used member variable 'x' with varid 0 ( #4489 )
2022-09-21 17:35:10 +02:00
Daniel Marjamäki
8275f07692
dump: Add Token::isCast attribute
2022-09-18 12:42:58 +02:00
Oliver Stöneberg
897826006e
mitigated some clang-tidy warnings in headers ( #4472 )
...
* 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
339484d2a1
mitigated and enabled more clang-tidy warnings ( #4470 )
...
* fixed some `performance-inefficient-string-concatenation` clang-tidy warnings
* fixed and enabled `modernize-replace-random-shuffle` clang-tidy warning
* fixed and enabled `bugprone-suspicious-string-compare` clang-tidy warning
* mitigated and enabled `readability-non-const-parameter` clang-tidy warnings
* clang-tidy.md: documented some disabled checks
* mitigated and enabled `performance-unnecessary-value-param` clang-tidy warnings
2022-09-16 18:58:59 +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
Daniel Marjamäki
f1aa9eb48f
dump: add externLang attribute for tokens
2022-09-15 19:57:42 +02:00
Oliver Stöneberg
76d1b9f31a
avoid unnecessary copies with `emplace_back()` ( #4450 )
...
* avoid unnecessary copies with `emplace_back()`
* cmdlineparser.cpp: suppress `accessMoved` selfcheck false positives
2022-09-10 11:25:15 +02:00
Daniel Marjamäki
92845295b8
Fix broken CI caused by my qt fix
2022-09-08 11:12:38 +02:00
Oliver Stöneberg
d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` ( #4451 )
2022-09-08 09:21:35 +02:00
Daniel Marjamäki
2e8d855b35
Tokenizer: Skip qt simplification if qt library is not loaded
2022-09-08 07:47:58 +02:00
Daniel Marjamäki
b99474fe13
Tokenizer: Remove redundant setVarId call
2022-09-08 07:46:19 +02:00
Daniel Marjamäki
5e0fc24bb7
Fixed #11232 (Syntax Error: AST broken, binary operator '!=' doesn't have two operands)
2022-08-27 18:02:19 +02:00
chrchr-github
7156afe003
Fix #5140 FN (error) buffer access out of bounds - known argument ( #4402 )
...
* Fix #5140 FN (error) buffer access out of bounds - known argument const char* argv[]
* Format
2022-08-26 17:27:54 +02:00
chrchr-github
80a486dda0
Fix #11167 FP virtual call in destructor even though class is final / Delete 'final' from specializations ( #4383 )
...
* Add 'final' keyword
* Delete 'final' from specializations
* Fix #11167 FP virtual call in destructor even though class is final
* Fix test
2022-08-19 18:26:00 +02:00
Oliver Stöneberg
16f598c409
added missing `sstream` includes ( #4381 )
2022-08-19 10:16:23 +02:00
chrchr-github
1aa259569e
Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) … ( #4374 )
...
* Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) { return v; }
* Format
2022-08-18 23:38:45 +02:00
Oliver Stöneberg
5f171b9673
fixed some `modernize-use-emplace` false negatives with `std::stack` / removed `internalStlUsage` check ( #4346 )
2022-08-17 09:50:14 +02:00
Paul Fultz II
72c764b034
Expose exprId to addon ( #4354 )
2022-08-16 22:00:31 +02:00
Oliver Stöneberg
4bf5dcd29f
cleaned up includes based on include-what-you-use ( #4358 )
...
* cleaned up includes based on include-what-you-use
* testlibrary.cpp: no need for `empyString` optimization
2022-08-14 12:44:19 +02:00
chrchr-github
974e34490f
Fix #9282 FP Unused private function ( #4327 )
2022-08-07 20:06:32 +02:00
Oliver Stöneberg
156323c95e
avoid unnecessary copies with `insert()` ( #4323 )
2022-08-07 19:31:16 +02:00
chrchr-github
d5a0dfda00
Fix #11239 checkLibraryCheckType with asm goto() (invalid varid), add test for #8666 ( #4340 )
...
* Add test for #6541 , avoid duplicate warning
* Add test for #5475
* Fix test
* Merge
* Add test for #8666
* Fix #11239 checkLibraryCheckType with asm goto() (invalid varid)
* Format
2022-08-04 21:35:18 +02:00
chrchr-github
dd927aab9b
Fix #11237 checkLibraryNoReturn with unassigned object ( #4338 )
...
* Handle float values
* Fix #11237 checkLibraryNoReturn with unassigned object
2022-08-03 19:04:10 +02:00
chrchr-github
38fdbe0890
Fix #9716 Syntax error for function-try-block in global scope ( #4305 )
...
* Fix #9716 Syntax error for function-try-block in global scope
* static through instance
* Handle multiple catch blocks
* Add test
* Fix skip logic
* Handle init lists in simplifyFunctionTryCatch()
2022-07-31 14:49:50 +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
Oliver Stöneberg
b65b47d3a8
enabled and fixed `modernize-pass-by-value` clang-tidy warnings ( #4169 )
2022-07-28 22:51:45 +02:00
Oliver Stöneberg
d6eb3a8f40
some changes for clang/clang-tidy 15 ( #4310 )
2022-07-26 15:30:53 +02:00
Daniel Marjamäki
db155a59c1
Tokenizer: remove simplifyTokenList2
2022-07-18 16:20:36 +02:00
chrchr-github
b08aabefee
Fix #9877 FP unreadVariable (incomplete code; missing macro definition) ( #4278 )
2022-07-17 19:40:39 +02:00
chrchr-github
47c2a01392
Fix #11166 inefficient way to remove last character from std::string ( #4267 )
...
* Fix #11166 inefficient way to remove last character from std::string
* Format
* Modify message, add test
* Format
* Fix another warning
2022-07-11 23:07:37 +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
Daniel Marjamäki
d8239b26f1
Tokenizer: Remove simplifyCalculations from simplifyTokenList2
2022-07-04 22:54:43 +02:00
Daniel Marjamäki
d204c5f894
Tokenizer: Cleanup stuff in simplifyTokenList2
2022-06-25 17:09:51 +02:00
chrchr-github
63e567eb50
Remove simplifyKnownVariables() ( #4232 )
...
* Remove simplifyKnownVariables()
* Add some test cases back
* Remove unused functions
* Format
2022-06-25 08:38:17 +02:00
chrchr-github
a658baf962
Fix #11143 FP: unreadVariable (remove simplifyMathExpressions()) ( #4227 )
...
* Fix #11143 FP: unreadVariable (remove simplifyMathExpressions())
* Remove unused function, tests
2022-06-21 15:42:23 +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
Daniel Marjamäki
6873f5237b
Tokenizer: removing more stuff from simplifyTokenList2
2022-06-19 10:41:15 +02:00
Daniel Marjamäki
a7815ed5b0
Tokenizer: Remove more stuff from simplifyTokenList2
2022-06-18 07:31:36 +02:00
Daniel Marjamäki
aa8c17a701
Tokenizer: remove stuff from simplifyTokenList2
2022-06-17 09:44:58 +02:00
Daniel Marjamäki
dbb12cb333
Tokenizer: Remove some functions from simplifyTokenList2
2022-06-16 14:06:07 +02:00
Paul Fultz II
46fcdca5ee
Add debug_valuetype intrinsic ( #4210 )
2022-06-15 21:25:55 +02:00
Daniel Marjamäki
343d04feb4
Tokenizer: Remove simplifyCharAt from simplifyTokenList2
2022-06-12 15:14:48 +02:00
PKEuS
cb382ac52c
C++20 support: Support consteval and constinit ( #4203 )
...
Backported from LCppC.
2022-06-11 15:28:20 +02:00
Daniel Marjamäki
533b3e2bcb
Tokenizer: Clarify code. The variableMap.find, variableMap.end was not strictly matching.
2022-06-11 09:47:06 +02:00
PKEuS
99ce89c003
Improvement: Set varId for variables with global scope operator :: Refactorization: Moved internal class from tokenize.h to tokenize.cpp ( #4184 )
...
Merged from LCppC.
2022-06-11 08:11:16 +02:00
Daniel Marjamäki
375880988c
Tokenizer: remove removeRedundantAssignment from simplifyTokenList2
2022-06-10 12:35:05 +02:00
Daniel Marjamäki
a76ba698c2
Tokenizer: remove simplifyCompoundAssignment from simplifyTokenList2
2022-06-09 07:38:27 +02:00
Daniel Marjamäki
c0f3d5b2fb
Tokenizer: remove simplifyAssignmentInFunctionCall used in simplifyTokenList2
2022-06-08 19:08:18 +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
Daniel Marjamäki
86a8d88729
Tokenizer: Remove simplification of math functions from simplifyTokenList2
2022-06-08 09:58:11 +02:00
chrchr-github
bb3f490edd
Fix #11090 Infinite recursion in findTypeInBase() ( #4178 )
2022-06-08 09:20:16 +02:00
Paul Fultz II
e430a11b49
Add debug_valueflow instrinsic to show valueflow values and its error path ( #4159 )
...
* Add debug_valueflow instrinsic to show valueflow values and its error path
* Format
2022-06-01 06:53:21 +02:00
chrchr-github
2ceaf308de
Fix #11084 : ValueType for pointer typedef, don't warn for typedef'd pointers, improve error message ( #4123 )
...
* 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
Daniel Marjamäki
03c9253962
Token: add isRestrict flag
2022-05-22 14:10:55 +02:00
Paul Fultz II
e2c35abde5
Fix 11050: False positive: unreadVariable for class variable when another function uses the same variable name ( #4121 )
2022-05-22 09:20:32 +02:00
Paul Fultz II
a62fb986a5
Fix 11090: Infinite recursion in findTypeInBase() ( #4120 )
2022-05-21 08:24:29 +02:00
chrchr-github
52f507d1fb
Fix #8004 unintentional semicolon in expression '.. ; +dostuff();' ( #4109 )
...
* Fix #8004 unintentional semicolon in expression '.. ; +dostuff();'
* Improve error message
* Don't remove single unary + in front of variables
2022-05-13 06:54:02 +02:00
Daniel Marjamäki
4257f9d46a
Tokenizer: fix for __attribute__ before function that returns a reference
2022-05-10 20:59:24 +02:00
chrchr-github
a70d11adb6
Fix #11052 inline static global struct declaration interferes with checks ( #4098 )
2022-05-10 20:43:11 +02:00
chrchr-github
759c16fcef
Fix boolean expressions ( #4099 )
...
* Enable experimental check
* Remove experimental
* Don't compare Booleans using relational operators
* Fix boolean expressions
2022-05-10 20:42:24 +02:00
Daniel Marjamäki
0a4e2abf01
dump: add token isComplex attribute
2022-05-10 19:05:02 +02:00
chrchr-github
e2bb77f990
Remove severity 'experimental' from checkComparisonOfBoolWithBool() ( #4097 )
...
* Enable experimental check
* Remove experimental
* Don't compare Booleans using relational operators
2022-05-10 18:25:13 +02:00
Daniel Marjamäki
eb9c4b4aed
Tokenizer: Fix handling of __attribute__ for overloaded operator function
2022-05-08 18:19:52 +02:00
Daniel Marjamäki
fab55287f7
Tokenizer: improved handling of __asm__ in function declaration
2022-05-08 16:03:09 +02:00
Daniel Marjamäki
449d351095
Revert "Tokenizer: handle when __asm__ directive is provided for function"
...
This reverts commit f25b8cf662
.
2022-05-07 21:53:10 +02:00
Daniel Marjamäki
f25b8cf662
Tokenizer: handle when __asm__ directive is provided for function
2022-05-07 19:40:03 +02:00
chrchr-github
612d7be85a
Fix #11045 syntaxError with unknown macros and using namespace ( #4086 )
2022-05-05 19:47:56 +02:00
chrchr-github
51b4cf592b
Fix #11029 unknownMacro reported with noexcept (regression) ( #4073 )
2022-05-03 13:37:14 +02:00
chrchr-github
67f4fe575f
Fix #10978 syntaxError with attribute for function pointer ( #4069 )
2022-05-02 15:05:48 +02:00
chrchr-github
e9a0d7979e
Fix #11014 FN redundantPointerOp / remove simplifyMulAndParens() ( #4062 )
2022-05-01 15:46:07 +02:00
chrchr-github
961ecfbe33
Fix #11003 cppcheckError with nested template arguments ( #4049 )
2022-04-25 22:23:06 +02:00
chrchr-github
b4df064875
Fix #11004 FP AssignmentIntegerToAddress with volatile ( #4046 )
2022-04-25 22:00:37 +02:00
chrchr-github
c8936d04f6
Fix #3886 New Check : Return value of "new" ignored ( #3884 )
2022-04-09 19:06:32 +02:00
Oliver Stöneberg
25ef9eeb26
use std::string::empty() ( #3910 )
2022-04-09 19:02:37 +02:00
Paul Fultz II
d2a0b0f78e
Fix 10951: FP knownEmptyContainer with east-const ( #3988 )
...
* Fix 10951: FP knownEmptyContainer with east-const
* Format
* Use simpleMatch
2022-04-08 08:22:39 +02:00