Commit Graph

739 Commits

Author SHA1 Message Date
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