Commit Graph

377 Commits

Author SHA1 Message Date
Ken-Patrick Lehrmann b3b3b6b2a1
Fix handling of namespace scope with several bodystarts (#3438)
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
Paul Fultz II fdaeaacc40
Symboldatabase: Improve valuetypes for containers, iterators, and smart pointers (#3398) 2021-08-14 19:00:58 +02:00
Daniel Marjamäki 0093452bed SymbolDatabase; Better handling of namespace that is defined in several scopes 2021-08-10 07:00:11 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Paul Fultz II 00eb71fd49
Remove constexpr -> const simplification (#3346) 2021-07-22 07:22:26 +02:00
Daniel Marjamäki b1547a387e astyle formatting
[ci skip]
2021-07-21 20:13:38 +02:00
Paul Fultz II 8efe1d4ab4
Find reference to dangling unique ptr (#3344) 2021-07-20 21:30:27 +02:00
Daniel Marjamäki d1fe34e167 misra; implement rule 8.10 2021-07-18 21:18:07 +02:00
Paul Fultz II 59a1c1a9d8
Refactor: Remove variable analyzer (#3339) 2021-07-18 07:46:31 +02:00
Daniel Marjamäki 7cb66d56f3 missingReturn; fixed false positive with trailing return type 2021-07-08 13:50:26 +02:00
orbitcowboy a585834445 Running astyle [ci skip] 2021-06-03 07:35:50 +02:00
Paul Fultz II 3e78e76fe8
Fix issue 10076: ValueFlow: False positive after address of var is taken 'T t = {{{&var}}};' (#3283) 2021-06-03 07:31:46 +02:00
Paul Fultz II 31e3e4d87b
Fix issue 10086: false positive: (style) constVariable: Variable 'x' can be declared with const (#3219) 2021-04-30 17:47:08 +02:00
Daniel Marjamäki d2d2124238 Revert "Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again."
This reverts commit 207361b174.
2021-04-30 16:47:02 +02:00
Daniel Marjamäki 207361b174 Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again. 2021-04-21 18:59:48 +02:00
Oliver Stöneberg 6397e29f84
cleaned up includes based on include-what-you-use (#3141) 2021-04-03 21:30:50 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
Daniel Marjamäki b2691bda88 Fixed false positive in self check 2021-03-20 18:54:46 +01:00
Daniel Marjamäki 1151c3dafd Fixed msvc compilation error by implementing Variable::operator= 2021-01-28 13:46:15 +01:00
Daniel Marjamäki dc230d18ef Try to fix Cppcheck self-check warnings 2021-01-28 12:36:31 +01:00
Daniel Marjamäki 203d6ebe5a Fixed #10100 (FP: shadowVariable clangimport) 2021-01-27 20:03:42 +01:00
orbitcowboy bb451ca289 Running astlye [ci skip] 2021-01-22 21:47:24 +01:00
Paul Fultz II 8b26ecbcdd
Extend ProgramMemory to handle expressions (#3069) 2021-01-21 19:49:37 +01:00
IOBYTE fde5994cc3
fix #10061 (debug: Executable scope 'x' with unknown function.) (#3062) 2021-01-18 19:01:04 +01:00
Daniel Marjamäki 168db9351d ClangImport; set exprid 2021-01-06 11:03:43 +01:00
Oliver Stöneberg 20e462a8ed
split "varid0" from more generic "debug" messages (#2997) 2020-12-31 19:24:16 +01:00
Daniel Marjamäki 8bd783f820 Refactoring; Added findBreakScope and Scope::isLoopScope() 2020-12-24 22:58:31 +01:00
Daniel Marjamäki 8b52ed590e Clang import: Better handling of const methods 2020-11-09 14:50:34 +01:00
Daniel Marjamäki 8956ecb5fc Clang import: Fixed data for inline static functions 2020-11-03 17:52:53 +01:00
Daniel Marjamäki e053066d8b Clang import: Fixed Variable::mTypeStartToken and Variable::mTypeEndToken for unnamed parameters 2020-11-02 20:58:43 +01:00
Daniel Marjamäki 6de91d6386 Fixed #9707 (False positive: unreadVariable, union) 2020-10-02 20:22:22 +02:00
Daniel Marjamäki 514b7f4da4 Fixed #9906 (False positive: constParameter (function pointer)) 2020-09-23 22:10:47 +02:00
Daniel Marjamäki f052d32e31 astyle formatting 2020-09-10 08:02:45 +02:00
Paul Fultz II 34d65e25d6
Merge branch 'main' into lifetime-subfunction 2020-09-09 12:02:02 -05:00
Daniel Marjamäki 687b44dbb7 Token: add flag for splitted variable declaration with initialization 2020-09-09 16:22:47 +02:00
Paul 786672e19d Format 2020-09-06 21:59:21 -05:00
Paul c7a5d3c5f1 Fix FPs 2020-09-06 21:58:36 -05:00
Daniel Marjamäki 5acd6fcdc8 astyle formatting 2020-09-03 18:55:40 +02:00
shaneasd 08ea6435ac
fix false positives in constParameter (#2758) 2020-09-03 18:44:44 +02:00
Paul Fultz II a332062385
Add exprId to tokens (#2744) 2020-08-20 18:21:29 +02:00
Paul Fultz II eb4754b7d9
Fix issue 9587: False positive: parameter can be declared with const (#2667) 2020-05-31 10:10:10 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki f7096a2232 Bug hunting: basic handling of contracts through GUI 2020-04-27 09:08:50 +02:00
Oliver Stöneberg 2c1e36e63e
cleaned up includes based on include-what-you-use (#2600)
* cleaned up includes based on include-what-you-use

* check.h: trying to work around Visual Studio 2012 bug

* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
shaneasd 82c09f243b
Maybeunusedsupport (#2570)
* Add rudimentary support for [[maybe_unused]]

* Add more test cases. use the symboldatabase rather than reparsing. Fix travis error.

* test review actions

* change var to usage._var
2020-04-12 20:35:54 +02:00
Dmitry-Me ab5835d359
Avoid giant C4267 warning in 64-bit Visual C++ build (#2569) 2020-03-14 14:41:45 +01:00
Daniel Marjamäki e31b2f8b73 SymbolDatabase; Set smart pointer type in Variable valueType 2020-02-14 09:40:27 +01:00
Daniel Marjamäki b1abcc06df Clang import; distinguish static variable 2020-01-27 13:00:52 +01:00