Daniel Marjamäki
9009eeb83d
Tweak Function::isSafe()
2019-07-25 20:52:24 +02:00
Daniel Marjamäki
4611cbb5bb
One more fix for Function::isSafe
2019-07-25 17:31:52 +02:00
Daniel Marjamäki
09be07f2b2
Fix Function::isSafe
2019-07-25 17:28:32 +02:00
Paul Fultz II
bb52a63c4e
Add check for const variables
...
When a local reference is declared, this will check if that local reference can be declared as `const`.
2019-07-24 09:59:01 +02:00
Daniel Marjamäki
753efb4c9b
Function::isSafe: handle global/namespace functions better
2019-07-24 08:23:05 +02:00
Daniel Marjamäki
4fb6c27276
Modernize: Use enum class
2019-07-23 14:29:02 +02:00
Daniel Marjamäki
681bd0a911
GUI: Better settings for extended safe checks
2019-07-23 11:54:38 +02:00
Daniel Marjamäki
74bd2aa680
Use range for loop
2019-07-22 12:24:16 +02:00
Daniel Marjamäki
a81c39af09
Replace 'unsigned' with 'nonneg'
2019-07-22 11:25:51 +02:00
Daniel Marjamäki
28e5133f50
Refactoring: Use range for loop
2019-07-18 14:55:01 +02:00
Daniel Marjamäki
e489d9a40f
Fix bug. Used wrong ValueType in smart pointer handling
2019-07-13 20:29:15 +02:00
IOBYTE
9700490e51
fix lib/checkclass.cpp:51:12: warning: enumeration value ‘eLambda’ not handled in switch [-Wswitch] ( #1978 )
2019-07-11 08:25:25 +02:00
Daniel Marjamäki
c9906125de
Safe functions: Check more possible function argument values
2019-07-10 16:59:05 +02:00
Daniel Marjamäki
58076bc672
SymbolDatabase: Better handling of smart pointers
2019-07-09 17:32:19 +02:00
Daniel Marjamäki
862c4ef87b
Symboldatabase: Fix possible null pointer dereference if smart pointer type does not have a scope
2019-07-08 17:43:45 +02:00
Daniel Marjamäki
a0b22410cf
SymbolDatabase: Better handling of smart pointers
2019-07-07 21:52:49 +02:00
Paul Fultz II
65af02f0cf
Fix crash with lambda capture ( #1960 )
2019-07-06 10:46:17 +02:00
Paul Fultz II
e0ced1c415
Parse lambdas as functions ( #1955 )
...
* Parse lambdas as functions
* Fix issue with missing paren
* Fix error when parsing non-existent args
* Remove unused function variable
2019-07-05 12:30:42 +02:00
shaneasd
7e54f989f9
Update symbol database such that the override keyword implies that the function is also virtual ( #1907 )
...
* Update symbol database such that the override keyword implies that the function is also virtual
* Add test case for implicit override
* change isVirtual to hasVirtualSpecifier
* fix method documentation for getVirtualFunctionCalls and getFirstVirtualFunctionCallStack
* Fix isImplicitlyVirtual to consider the override keyword and document logic
* Fix getFirstVirtualFunctionCallStack and getVirtualFunctionCalls to use isImplicitlyVirtual instead of isVirtual so new test case passes
2019-07-04 12:32:32 +02:00
Scott Furry
a195477470
Correct Zero/Null as pointer constant ( #1938 )
...
Building with enhanced clang warnings indicated a large number of
instances with the warning:
`warning: zero as null pointer constant`
Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.
Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
IOBYTE
8b347aed42
Fixed #8663 (Stack overflow with template disambiguator) ( #1932 )
2019-06-28 22:07:21 +02:00
Ken-Patrick
66ebc187f6
Cleanup some const_cast of Token* ( #1886 )
...
* Add non const version of some methods of Token
The aim is to reduce the (ab)use of const_cast.
* Cleanup some more const_cast in valueflow
* Remove useless const_cast
* Remove some const_cast from templatesimplifier
* Remove some const_cast from valueflow
2019-06-16 10:09:38 +02:00
Daniel Marjamäki
8359d85b12
Fix Cppcheck warning
2019-06-15 13:23:21 +02:00
Daniel Marjamäki
f66cbac0a4
Fix Cppcheck warning
2019-05-30 21:48:12 +02:00
Daniel Marjamäki
de07e2177c
Fix Travis hang
2019-05-30 21:25:14 +02:00
Daniel Marjamäki
66a61fe5e8
SymbolDatabase: Improved findFunction
2019-05-30 20:26:45 +02:00
Daniel Marjamäki
36b6fb9f4d
Fixed #8558 (False portability positive caused by incorrect method resolution)
2019-05-30 19:24:51 +02:00
Paul Fultz II
195da2b3d2
Fix issue 8993: False positive duplicateCondition related to auto ( #1831 )
2019-05-14 08:57:36 +02:00
adamjrichter
47ce998e6e
lib: Separate statements of the form "assert(a && b)" into "assert(a)" and "assert(b)", for more precise diagnostics. ( #1825 )
2019-05-07 10:28:31 +02:00
Rikard Falkeborn
1cc5f3abe7
Set wchar_t type ( #1807 )
...
This is necessary for valueflow to know the size, for example when
calculating sizeof(wchar_t).
2019-05-01 16:34:28 +02:00
Paul Fultz II
39f4374446
Improve diagnostics with null smart pointers ( #1805 )
...
* Warn when dereferencing null smart pointers
* Improve tracking of smart pointer values
* Use library isSmartPointer
2019-04-26 11:30:09 +02:00
Paul Fultz II
a90caa7e5a
Fix issue 9006: False positive: Return value of function std::move() is not used.
...
This is trying to fix the issue by fixing the ast and symbol database. First, the ast nodes will be created for the init list and the symbol database will not mark it as a scope. I am not sure if this is the correct approach as I dont really understand how the AST part works.
It did change the AST for `try {} catch (...) {}` but that is because it incorrectly treats `try {}` as an initializer list.
2019-04-15 06:37:27 +02:00
Daniel Marjamäki
0368648aff
debug warnings; report missing type for auto tokens
2019-03-31 17:38:00 +02:00
Daniel Marjamäki
b0c58f2b10
Fixed #9000 (SymbolDatabase: lambda scope)
2019-03-30 10:32:36 +01:00
Daniel Marjamäki
fe285f1df3
Fixed #9055 (SymbolDatabase: second argument is missing in the symbol database)
2019-03-30 07:44:36 +01:00
IOBYTE
b6faa11fbf
Fixed #9056 ("using namespace" inside namespace causes "SymbolDatabase bailout;) ( #1753 )
...
Fixed the bailout warning and one of the varid bugs.
The trailing return type still has a varid.
2019-03-24 17:31:34 +01:00
Paul Fultz II
91138578cc
Fix 9052: Crash: SIGSEGV in Token::previous (this=0x0) while checking mariadb-10.0
2019-03-22 01:56:09 +01:00
Paul Fultz II
774464eabb
Fix issue 8996: False positive duplicateCondition
...
This fixes issue 8996 by improving the alias checking by using lifetime analysis. It also extends the lifetime checker to handle constructors and initializer lists for containers and arrays.
2019-03-19 06:25:10 +01:00
Daniel Marjamäki
92f4113b59
Array index: Checking array index out of bounds for dynamic buffers
2019-03-17 13:09:15 +01:00
Daniel Marjamäki
d0c1632b51
Fix CheckBufferOverrun::array_index_12 when compiling with VS
2019-03-16 19:41:13 +01:00
Daniel Marjamäki
a2a216bbe3
SymbolDatabase: Improved handling of 'normal' non simplified token list
2019-03-15 19:00:42 +01:00
Daniel Marjamäki
a1ade2dd7d
Refactoring: Use range for
2019-03-14 19:57:58 +01:00
Daniel Marjamäki
56c47fc6ed
Refactoring: use continue
2019-03-14 19:53:45 +01:00
Daniel Marjamäki
1b4895a579
ValueType: Set ValueType for false/true
2019-03-09 17:27:27 +01:00
Daniel Marjamäki
226f0c7544
Fixed ValueType for auto variable
2019-02-27 10:28:18 +01:00
rikardfalkeborn
0e988cc755
Fix #8992 : Add originalTypeToken to auto ( #1701 )
2019-02-27 06:44:31 +01:00
Daniel Marjamäki
d84d8885f7
SymbolDatabase: Fix TODO assertions
2019-02-24 19:11:18 +01:00
Daniel Marjamäki
ef731064bd
Fixed #8964 (ValueType: auto constness)
2019-02-24 08:16:08 +01:00
Daniel Marjamäki
c855cf8682
ValueType: Better constness for auto variable
2019-02-23 18:16:18 +01:00
Daniel Marjamäki
b43572d75e
Fixed #8969 (C++ functional cast not handled correctly)
2019-02-23 17:29:53 +01:00
rikardfalkeborn
dc4e7cef88
Run simplifyPlatformTypes on library return types ( #1672 )
...
Add a call to simplifyPlatformTypes() in
SymbolDatabase::setValueTypeInTokenList() to simplify return types of
library configured functions. This fixes the FN in #8141 . Regression
tests are added, both for the original issue and another FN in the comments.
In order to do that, move simplifyPlatformTypes() to TokenList from Tokenizer.
This is a pure refactoring and does not change any behaviour. The code was
literally copy-pasted from one file to another and in two places
'list.front()' was changed to 'front()'.
When adding the call to simplifyPlatformTypes(), the original type of
v.size() where v is a container is changed from 'size_t' to 'std::size_t'.
Tests are updated accordingly. It can be noted that if v is declared as
'class fred : public std::vector<int> {} v', the original type of 'v.size()'
is still 'size_t' and not 'std::size_t'.
2019-02-15 13:29:52 +01:00
Daniel Marjamäki
bd7790fd8c
Update copyright year
2019-02-09 07:24:06 +01:00
IOBYTE
05a3e6807b
Fixed #8950 and #8952 (improve type alias support) ( #1633 )
...
* Fixed #8950 and #8952 (improve type alias support)
* fix travis build
2019-01-31 16:53:51 +01:00
Paul Fultz II
3975913637
Extend lifetime checking for references
...
This will use the lifetime checker for dangling references. It will find these cases for indirectly assigned reference:
```cpp
int &foo()
{
int s = 0;
int& x = s;
return x;
}
```
This will also fix issue 510 as well:
```cpp
int &f( int k )
{
static int &r = k;
return r;
}
```
2019-01-23 07:29:16 +01:00
Lauri Nurmi
f267900257
Fix spelling of "overridden" in function names.
...
One 'd' was missing.
2019-01-15 06:22:14 +01:00
IOBYTE
0f83aff3b8
Improve trailing return type support. ( #1520 )
...
* Improve trailing return type support.
* Partial fix for #8889 (varid on function when using trailing return type)
* Handle operators in templates.
2018-12-13 06:34:10 +01:00
Paul Fultz II
54453c5802
Fix FP when copying pointer to string ( #1479 )
2018-11-14 06:59:25 +01:00
IOBYTE
e302e6e7a1
Fix symbol database argsMatch to skip all redundant type information (class, struct, union, enum) ( #1472 )
2018-11-09 15:54:17 +01:00
IOBYTE
67fe99fcd9
Fix symbol database argsMatch function and its usage so qualified types are handled properly. ( #1470 )
...
* Fix symbol database argsMatch function and its usage so qualified types are handled properly.
* Remove assert.
2018-11-09 06:11:48 +01:00
IOBYTE
2275f05f65
Fixed #8833 (false negative: No 'return' statement in non-void function causes undefined behavior.) ( #1463 )
2018-11-05 06:55:30 +01:00
Daniel Marjamäki
efd92fd714
Refactoring: reuse utility function in SymbolDatabase
2018-11-04 13:29:29 +01:00
Daniel Marjamäki
d265a0d6ab
Fixed #8798 (SymbolDatabase: Inner unnamed union)
2018-10-20 09:43:08 +02:00
rikardfalkeborn
5e120b567c
isVariableDeclaration: Handle pointer to const pointer ( #1395 )
...
isVariableDeclaration did not handle pointer to const pointer, or
pointer to volatile pointer. This resulted in FPs in examples like the
following:
class Fred {
public:
const char *const *data;
const char *const *getData() { return data; };
}
where cppcheck would say getData could be static, since it didn't
recognize const char *const *data as a variable declaration.
2018-09-25 06:19:26 +02:00
IOBYTE
01f9ce2c4a
Improve debug printing of type qualification when declaration and definition are in different scopes. ( #1394 )
2018-09-24 06:40:20 +02:00
orbitcowboy
d08b39c915
Improved const correctness of local variables. There are no functional changes intended. ( #1392 )
2018-09-23 20:24:51 +02:00
Daniel Marjamäki
5afb755a3c
SymbolDatabase: Fix variable matching
2018-09-04 06:39:02 +02:00
Daniel Marjamäki
e442bc47b1
astyle formatting
...
[ci skip]
2018-08-17 19:55:21 +02:00
Sylvain Joubert
13617375df
missingOverride: False positive with cv-ref mismatch ( #1340 )
2018-08-17 08:42:22 +02:00
Daniel Marjamäki
10e693a8c3
Revert "SymbolDatabase: Improved lookup of function calls"
...
This reverts commit 3c87d60d5d
.
2018-06-26 23:14:12 +02:00
Daniel Marjamäki
3c87d60d5d
SymbolDatabase: Improved lookup of function calls
2018-06-26 22:12:12 +02:00
Daniel Marjamäki
c583fb9186
Revert "SymbolDatabase: Improved lookup of function calls"
...
This reverts commit e4a70f87e6
.
2018-06-26 13:05:33 +02:00
Daniel Marjamäki
e4a70f87e6
SymbolDatabase: Improved lookup of function calls
2018-06-26 11:38:45 +02:00
Daniel Marjamäki
10fc070f44
SymbolDatabase: Better handling of type aliases in ValueType
2018-06-20 14:49:55 +02:00
Daniel Marjamäki
b62c562a89
Try to make Travis happy
2018-06-20 14:13:04 +02:00
Daniel Marjamäki
b4cb2505c3
SymbolDatabase: Add Variable::valueType(). First step to reuse ValueType handling in Variable
2018-06-20 10:00:15 +02:00
Daniel Marjamäki
9edcae97fc
Fixed #8578 (Argument scope as global)
2018-06-19 08:50:32 +02:00
Daniel Marjamäki
ad4ce84cf7
Rename private member variables
2018-06-17 17:20:16 +02:00
orbitcowboy
0b74a90e75
symboldatabase: removed duplicate keywords in C++-keyword list.
2018-06-17 17:05:36 +02:00
Daniel Marjamäki
c102638970
astyle formatting
2018-06-17 08:45:26 +02:00
Daniel Marjamäki
d9aeeb1d09
Renamed private member cpp to mIsCpp
2018-06-16 23:30:00 +02:00
Daniel Marjamäki
306b2a9810
Renamed private member defaultSignedness
2018-06-16 23:25:35 +02:00
Daniel Marjamäki
678e3271d4
Rename private flags member to mFlags
2018-06-16 23:11:45 +02:00
Daniel Marjamäki
15f7c26706
Renamed _blankTypes
2018-06-16 20:33:07 +02:00
Daniel Marjamäki
56126d6e2d
Renamed _variableList to mVariableList
2018-06-16 20:31:47 +02:00
Daniel Marjamäki
e8a00a38ac
Rename _scope to mScope
2018-06-16 20:29:17 +02:00
Daniel Marjamäki
78974e9267
Rename _type to mType
2018-06-16 20:25:54 +02:00
Daniel Marjamäki
fc6f17ed87
Rename _dimensions to mDimensions
2018-06-16 20:23:58 +02:00
Daniel Marjamäki
363f4ca939
rename _flags to mFlags
2018-06-16 16:14:34 +02:00
Daniel Marjamäki
67b111f11e
SymbolDatabase: rename _constness to mConstness
2018-06-16 16:13:26 +02:00
Daniel Marjamäki
5154eb10c6
SymbolDatabase: rename _access
2018-06-16 16:12:27 +02:00
Daniel Marjamäki
7dfd4f61a1
SymbolDatabase: rename _index
2018-06-16 16:11:40 +02:00
Daniel Marjamäki
79ffe1d4fc
Rename _tokenizer, _settings, _errorLogger
2018-06-16 16:10:28 +02:00
Daniel Marjamäki
8209c4aebd
SymbolDatabase: rename _start and _end
2018-06-16 16:03:36 +02:00
Daniel Marjamäki
311454669f
SymbolDatabase: rename _name
2018-06-16 15:57:16 +02:00
Daniel Marjamäki
7b106c067a
Fixed #8603 (SymbolDatabase: 2 scopes with same function)
2018-06-03 23:14:24 +02:00
Daniel Marjamäki
df9b243227
Modernize: use ranged for loops in CheckNullPointer
2018-06-03 09:27:18 +02:00
Matthias Krüger
558a2f0cc7
SymbolDatabase::createSymbolDatabaseFindAllScopes(): hoist _tokenizer->isC(PP) dereference out of loop.
2018-06-02 13:38:15 +02:00
IOBYTE
7681bbf227
Fixed #8146 (false positive: enum initialized using class member initializer syntax in struct in struct) ( #1270 )
2018-05-30 15:40:16 +02:00
IOBYTE
3982c81394
Add support for C++ attribute nodiscard for functions. ( #1269 )
2018-05-29 21:43:56 +02:00
orbitcowboy
33777c5b72
Improved const correcntess of local variables.
2018-05-29 13:24:48 +02:00
IOBYTE
36f7585798
Fixed #8600 (false-positive/regression: confusion between copy constructors of internal classes and lack of explicit keyword) ( #1266 )
2018-05-27 10:53:34 +02:00
IOBYTE
8320be203d
Fixed #8258 (Incorrect diagnostics when using delegating consturctor with default values) ( #1255 )
2018-05-22 06:42:37 +02:00
IOBYTE
5c15cd3981
Fix DACA2 SymbolDatabase bailout; unhandled code for final class ( #1253 )
...
* Fix DACA2 SymbolDatabase bailout; unhandled code for final class
* Replace Match with simpleMatch
2018-05-21 21:23:21 +02:00
IOBYTE
42ed5a6b98
Fixed #8581 (Delegating contructor warns for unintialized variables) ( #1250 )
...
* Fixed #8581 (Delegating contructor warns for unintialized variables)
* Replace Token::Match with isStandardType
2018-05-20 22:58:05 +02:00
PKEuS
c4b6beac4d
Fixed calculation precedence warning introduced in recent commit
2018-05-14 15:24:32 +02:00
Matthias Krüger
4c8bb9ac6f
fix a few typos
2018-05-14 13:11:59 +02:00
PKEuS
090a178ed6
Refactorization in SymbolDatabase: Do not redundantly store name in FriendInfo, and store FriendInfo in vector instead of list
2018-05-14 12:18:59 +02:00
IOBYTE
5c06d08bfb
Fix many DACA2 SymbolDatabase bailout; unhandled code false positives ( #1225 )
2018-05-13 19:00:42 +02:00
IOBYTE
184537884f
Don't remove the volatile keyword so we can properly overload functions. ( #1218 )
...
* Don't remove the volatile keyword so we can properly overload functions.
I fixed all the checks that had tests that use volatile. There will
probably be more changes needed due to lack of test coverage for
volatile in some checks.
* Fix unused private function warning.
2018-05-10 07:40:01 +02:00
IOBYTE
5452c4dc4a
Fixed #8560 (Symboldatabase lacks entry for C++11 overloaded member function) ( #1217 )
2018-05-09 20:16:08 +02:00
Daniel Marjamäki
129bdb2752
SymbolDatabase::createSymbolDatabaseSetTypePointers: Optimize ~90%
2018-05-09 13:48:55 +02:00
IOBYTE
5d417bbfa1
SymbolDatabase: harden code for missing links ( #1207 )
...
* SymbolDatabase: harden code for missing links
Missing links for templates are common so check links before using them
to prevent crashes.
* SymbolDatabase: replace link check and single token match with match of two tokens
2018-05-06 08:23:07 +02:00
Daniel Marjamäki
4408628107
Fixed #8538 (SymbolDatabase: wrong parsing of noexcept)
2018-05-05 08:31:56 +02:00
IOBYTE
f94e9c5447
Fix #8540 (Syntax error involving forward-declared 'enum class') ( #1203 )
2018-05-04 07:56:20 +02:00
Daniel Marjamäki
59cc479855
Save bitfield bit counts
2018-05-02 20:55:11 +02:00
IOBYTE
c3c1abd05e
SymbolDatabase: improve checking of uninstantiated templates ( #1196 )
...
* SymbolDatabase: improve checking of uninstantiated templates
* Add bailout and debug warning for '>' token without a link in SymbolDatabase::findFunction()..
Don't crash on bad code simplification from tokenizer.
2018-05-01 07:32:19 +02:00
Daniel Marjamäki
fce7a0a128
dump: add Function::type
2018-04-30 16:52:51 +02:00
Daniel Marjamäki
7015fb097e
SymbolDatabase::isFunction: better handling of return types
2018-04-29 15:35:31 +02:00
Daniel Marjamäki
f336c2efe7
Refactoring; Renamed Scope::classStart and Scope::classEnd
2018-04-27 22:36:30 +02:00
Daniel Marjamäki
25599a76a7
Handle 'final' specifier better.
2018-04-27 14:57:43 +02:00
Daniel Marjamäki
b830f462e6
Added missingOverride checker; Function 'f' overrides function in base class but does not have the 'override' keyword.
2018-04-27 11:12:09 +02:00
Daniel Marjamäki
c7e5b941be
Symbol database: Minor tweaks
2018-04-27 10:35:11 +02:00
Daniel Marjamäki
d15b945c9e
SymbolDatabase::isFunction: Fix wrong detection function
2018-04-27 10:24:02 +02:00
Daniel Marjamäki
5384802e16
SymbolDatabase: Look for types in anonymous scopes
2018-04-26 17:55:04 +02:00
Daniel Marjamäki
d8634ca2a9
SymbolDatabase: Disable code for function pointers
...
This hopefully fixes all Travis crashes when running cppcheck:
[./test/Analysis/stack-addr-ps.c] (error) Internal error: Child process crashed with signal 11 [cppcheckError]
[./test/Index/complete-pointer-and-reference-to-functions.cpp] (error) Internal error: Child process crashed with signal 11 [cppcheckError]
[./test/SemaCXX/vararg-non-pod.cpp] (error) Internal error: Child process crashed with signal 11 [cppcheckError]
2018-04-25 18:48:26 +02:00
Daniel Marjamäki
e95c6e3038
Travis: Fix segmentation fault
2018-04-25 16:02:42 +02:00
Daniel Marjamäki
bd54986017
SymbolDatabase: Refactoring parsing of ) ... in functions
2018-04-25 14:35:09 +02:00
Daniel Marjamäki
6efe118aa3
Fix Cppcheck warning
2018-04-25 14:29:34 +02:00
Daniel Marjamäki
e97be9db2f
SymbolDatabase: Refactoring, move logic from SymbolDatabase to Function class. Add a Function::isOverride() method.
2018-04-25 12:05:49 +02:00
IOBYTE
fac851192a
SymbolDatabase: fix problem where definition coudn't find forward declaration in class ( #1190 )
2018-04-24 22:43:47 +02:00
Daniel Marjamäki
8310198cd5
SymbolDatabase: Refactoring and testing isImplicitlyVirtual
2018-04-24 13:53:58 +02:00
Daniel Marjamäki
bb227613bb
SymbolDatabase: Better type lookup in methods
2018-04-23 22:27:15 +02:00
Daniel Marjamäki
f021094f75
minor refactorings in SymbolDatabase
2018-04-23 21:45:25 +02:00
Daniel Marjamäki
e3a4ef795e
Refactoring: After conditional return the 'else' is not needed
2018-04-23 16:27:56 +02:00
Daniel Marjamäki
97c86ff0e6
Dumps: Added isVirtual/isImplicitlyVirtual info
2018-04-13 21:15:43 +02:00
Daniel Marjamäki
f7d65cd735
SymbolDatabase: add constness attribute for Variable
2018-04-12 20:23:34 +02:00
PKEuS
d2146844dd
Refactorizations:
...
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki
1767fe525b
Addons: Fixed handling of noname arguments
2018-04-10 11:10:10 +02:00
IOBYTE
8734e4dd38
Fix SymbolDatabase bailout to also support struct ( #1160 )
2018-04-09 18:53:55 +02:00
PKEuS
e2002db78d
Replaced make_container by C++11 initializer lists
2018-04-08 23:03:44 +02:00
IOBYTE
4f9073159a
Fix another SymbolDatabase bailout ( #1157 )
2018-04-08 07:29:19 +02:00
IOBYTE
20f0784c06
Fix #8470 ((error) SymbolDatabase bailout; unhandled code) ( #1155 )
2018-04-07 16:41:39 +02:00
Daniel Marjamäki
0daa3bba30
ValueType: Improved type handling of containers when [] operator is used
2018-04-06 22:26:35 +02:00
IOBYTE
7e15e39f39
Fix some new SymbolDatabase bailout; unhandled code syntax errors. ( #1152 )
2018-04-06 21:32:32 +02:00
Daniel Marjamäki
05acf9b352
Fixed #8470 ((error) SymbolDatabase bailout; unhandled code)
2018-04-06 16:03:58 +02:00
IOBYTE
9f386d305a
Fixed #8280 (False positive uninitMemberVar - initialized from nested overloaded function) ( #1151 )
2018-04-06 07:53:05 +02:00
IOBYTE
06133fa3ba
Refactor findFunction to unify two ValueFlow paths. ( #1149 )
2018-04-05 06:46:48 +02:00
jrp2014
b6504c70ca
Improve constness
2018-04-04 21:51:31 +02:00
IOBYTE
a62c932a8f
Improve findFunction for function calls with function calls as arguments. ( #1147 )
...
Duplicate the existing logic for variable to variable type comparisons
for function return type to variable type comparisons.
2018-04-04 20:44:01 +02:00
Daniel Marjamäki
3b07b749d6
Refactoring, use early return
2018-04-04 10:50:10 +02:00
IOBYTE
fa968d75bd
Partial fix for #8291 : (False positive uninitMemberVar when calling delegated constructor) ( #1142 )
2018-04-04 08:29:12 +02:00
IOBYTE
2a418fa0f5
Fixed #8466 (False Positive: Member variable is not initialized in the constructor. When using overloaded constructors) ( #1141 )
2018-04-02 18:32:45 +02:00
Daniel Marjamäki
9f92685b92
SymbolDatabase: Throw InternalError if parsing fails
2018-04-02 13:14:48 +02:00
Daniel Marjamäki
4af2e517b9
Fixed #8465 (SymbolDatabase: bailout if there is 'struct A::B ab[5];')
2018-03-31 17:54:47 +02:00
Daniel Marjamäki
95ccd9483b
gcc 4.5 compatibility
2018-03-30 20:57:25 +02:00
Daniel Marjamäki
814828f436
dump: save if variable is const
2018-03-14 11:54:23 +01:00
Daniel Marjamäki
8a3c25210d
SymbolDatabase: Remove useless break. As far as I know Tokenizer::syntaxError() throws an exception and therefore the break after the function call is unreachable
2018-02-05 23:28:33 +01:00
Matthias Krüger
f009cfc845
fix some typos found by codespell.
2018-02-04 20:53:43 +01:00
orbitcowboy
82c963d3a2
symboldatabase: Fix null pointer dereference, introduced by ee1ba85e15 (comments)
.
2018-02-02 08:45:13 +01:00
orbitcowboy
ee1ba85e15
symboldatabase: Fix potential null pointer dereference ( #1072 )
...
There is a potential `nullPointer` dereference in symboldatabase. This PR attempts to fix this. Additionally, this could be detected by Cppcheck as well.
Here is a reduced and compilable testcase, where Cppcheck fails to detect a potential `nullPointer` dereference:
```
class Scope
{
public:
bool bar();
int *definedType;
};
int f(Scope *new_scope)
{
int ret = 1;
if (new_scope)
{
if (new_scope->bar())
{
if (!new_scope->definedType) {} // check for null
ret = *new_scope->definedType; // dereference
}
}
return ret;
}
```
The corresponding ticket on track, addressing the false negative: https://trac.cppcheck.net/ticket/8375
2018-01-31 11:00:42 +01:00
IOBYTE
4710d80a40
Fix #5766 (FP: typedef array throws off parser) ( #1052 )
...
* Fix #5766 (FP: typedef array throws off parser)
* Fix travis build.
2018-01-24 09:51:22 +01:00
IOBYTE
3159d151d3
Fix symbol database crash on template type aliases by ignoring them. ( #1045 )
2018-01-21 21:22:26 +01:00
Simon Martin
b4f32206af
Ticket #8337 : Fix false positive in copy constructor detection. ( #1040 )
2018-01-20 14:46:09 +01:00
Simon Martin
8878e6dd0d
Ticket #8333 : Properly report a syntax error for functions with invalid parameter types. ( #1030 )
2018-01-18 08:51:35 +01:00
Daniel Marjamäki
c7c9b3cd65
Fixed Cppcheck warning about using const reference to avoid data copying
2018-01-15 22:31:15 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
IOBYTE
03603c85cf
Fixed #8331 (stack overflow: daca: firefox-58.0b14) ( #1027 )
2018-01-12 08:19:21 +01:00
IOBYTE
cefb2131c7
Add support for simple c++ 11 type ailases like: using INT = int; ( #1024 )
...
* Add support for simple c++ 11 type ailases like: using INT = int;
Only types supported by ValueType are supported. Complex types like
function pointers are not supported. Template type aliases are not
supported.
* Fix crash when type in using type alias is simplified away.
This fixes a crash when size_t is replaced with unsigned long in: using
size_t = unsigned long; by the tokenizer.
This does not fix the problem where Tokenizer::simplifyPlatformTypes()
simplifies away size_t in other cases. This is only a problem when the
new type is different from the platform type.
2018-01-10 22:16:18 +01:00
Iván Matellanes
cfeea3d35c
Fixed #7331 : Detect copy and move constructors with default parameters ( #1018 )
2018-01-07 14:20:19 +01:00
Matthias Krüger
af9b9595ce
SymbolDatabase::createSymbolDatabaseFindAllScopes(): simplify match pattern.
2018-01-01 05:02:55 +01:00
Oleksandr Redko
a8700f5622
Remove redundant parts of conditional expressions ( #988 )
...
All issues were found with PVS-Studio:
V560 A part of conditional expression is always true: tok. astutils.cpp 407
V560 A part of conditional expression is always true: size > 0. checkbufferoverrun.cpp 709
V547 Expression 'secondTrue' is always true. checkcondition.cpp 1013
V547 Expression 'firstTrue' is always true. checkcondition.cpp 1020
V560 A part of conditional expression is always true: !scan. checkio.cpp 1036
V560 A part of conditional expression is always true: scope->function. checknullpointer.cpp 395
V560 A part of conditional expression is always true: tok2. checkstl.cpp 268
V560 A part of conditional expression is always true: par. tokenize.cpp 9440
V547 Expression '!erased' is always true. symboldatabase.cpp 3990
2017-11-03 10:39:57 +01:00
Daniel Marjamäki
afbfc914bc
astyle formatting
...
[ci skip]
2017-10-20 01:53:20 +02:00
Sign Bit
aaafa72bc8
Use a 'negative cache' for tokens / enumerator checks ( #980 )
...
Checking whether a token is an enumerator in all the available scopes
is expensive. Once we determined that a token is not an enumerator,
skip all the expensive checks.
2017-10-18 18:01:36 +02:00
orbitcowboy
f1e5f64690
wxwidgets.cfg: Added support for wxMenu:Append().
2017-10-17 10:59:23 +02:00
Florin Iucha
6e737082da
Store the defined types in a map, for faster lookup
2017-10-17 09:00:14 +02:00
IOBYTE
352fd7a381
SymbolDatabase: Add support for functions in unions. ( #973 )
2017-10-15 11:49:36 +02:00
Alexey Eryomenko
22483baf72
missed simplification in parsing of std function declaration resulted in ( #967 )
...
wrong type detection
2017-10-03 22:10:13 +02:00
Daniel Marjamäki
aa38556e1c
SymbolDatabase: Simplification of code. My assumption is that start and end of scope is never null.
2017-09-20 23:06:19 +02:00
Daniel Marjamäki
3d587d2704
Revert "Fix CID 1368511"
...
This reverts commit 41a79152a9
.
2017-09-19 23:13:40 +02:00
Daniel Marjamäki
1a057bc23a
Revert "Remove redundant safety logic (CID 1368511)"
...
This reverts commit d892031f28
.
2017-09-19 23:13:31 +02:00
Daniel Marjamäki
d892031f28
Remove redundant safety logic (CID 1368511)
2017-09-19 23:07:02 +02:00
Dmitry-Me
41a79152a9
Fix CID 1368511
2017-09-19 22:35:00 +03:00
Dmitry-Me
05d58f5c51
Unify classEnd check for scope
2017-09-19 22:13:50 +03:00
Dmitry-Me
349a28705a
Clarify code with assertions
2017-09-15 01:11:27 +03:00
Dmitry-Me
0fe82335ac
Remove duplicated method call
2017-09-15 00:53:44 +03:00
Dmitry-Me
37dea8a5cf
Only check the value if it wasn't surely set by previous code
2017-09-12 23:20:07 +03:00
Dmitry-Me
9ff04b4df1
Resolve CID 1368512
...
Wrong pointer was being checked
2017-09-11 23:50:42 +03:00
Dmitry-Me
988de6422e
Omit repeated computations
2017-09-11 18:36:44 +03:00
Dmitry-Me
68f6cad2aa
Omit repeated search when no insertion occurs
2017-09-06 18:02:27 +03:00
Dmitry-Me
66524ef645
Clarify code using temporary
2017-09-06 18:00:23 +03:00
Dmitry-Me
c29f16a306
Cache and reuse values
2017-09-04 17:55:45 +03:00
Hinterwaeldlers
8aa568f085
Corrected noexcept constructor delegating handling ( #948 )
2017-09-02 22:54:23 +02:00
Dmitry-Me
7bd3dc5da6
Simplify array access with references
2017-08-28 18:19:03 +03:00
Dmitry-Me
7d19d1ea2e
Better use of temporary
2017-08-28 18:15:15 +03:00
Ayaz Salikhov
b8cd7dbb5c
Use nullptr instead of 0 or NULL ( #936 )
2017-08-09 20:00:26 +02:00
Daniel Marjamäki
32422c815b
Fix issue found by Coverity, scope cant be null since scope is dereferenced on all paths before the while and also unconditionally inside while
2017-08-02 08:17:29 +02:00
Daniel Marjamäki
55aec0ef1b
Fix issue detected by Coverity, vt2 is null checked and then dereferenced
2017-08-02 07:48:11 +02:00
Daniel Marjamäki
1758c3b4e7
Fix suspicious code found by Coverity, dont check if scope->function is null and then dereference it
2017-08-01 13:26:35 +02:00
Robert Reif
354a773bfe
Fix #8020 (ValueType: no value type for iterator + constant)
2017-07-16 11:27:32 -04:00
Daniel Marjamäki
fabe07ffd6
Merge pull request #924 from IOBYTE/master
...
Fixed #6985 (SymbolDatabase: Function pointer not set when calling bas…
2017-07-16 14:04:25 +02:00