Commit Graph

940 Commits

Author SHA1 Message Date
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
Robert Reif b0aec042a6 Fixed #6985(SymbolDatabase: Function pointer not set when calling base class function)
Use using namespace when looking up types.
2017-07-15 19:14:15 -04:00
Daniel Marjamäki ea598d5284 refactoring, use early return 2017-07-09 13:09:36 +02:00
Daniel Marjamäki 211d8c6020 Refactoring checking for unused variables (avoid FN when not taking address) 2017-07-01 22:45:51 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
amai 45ba1ff1e3 #8079 SymbolDatabase::createSymbolDatabaseEnums() crashes on invalid enum declaration 2017-05-25 09:50:14 +02:00
PKEuS 68d77b73da SymbolDatabase: Fixed parsing of unnamed arguments, properly detect pointers (#8052) 2017-05-07 09:03:58 +02:00
Robert Reif e2bfe1c0ec Fixed #8044: Crash below SymbolDatabase::setValueType 2017-05-01 14:12:50 -04:00
IOBYTE 8a668aa860 Add missing else that could cause an extra try scope to be added to the scope list (#8025)
Add an optional extended description…
2017-04-30 08:58:41 +02:00
Garrett Bodily ddfd4c6348 Write access type of functions and variables to xml dump 2017-04-29 07:18:16 +02:00
Robert Reif 964b744c96 Fixed #7990 (crash: SymbolDatabase::printOut()) 2017-04-29 07:02:49 +02:00
Robert Reif 78ad9825af Add support for auto variables in regular for loop. 2017-04-21 15:25:02 -04:00
Robert Reif 0ff8e49b69 Add support for auto variable initialized from function return type. 2017-04-20 15:22:57 -04:00
Robert Reif 69d18d9c29 Fix #7963: crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTransformFeedback.cpp 2017-04-20 10:03:29 -04:00
Daniel Marjamäki 4f64e67298 Misra: Add rule 8.11 2017-04-17 07:45:27 +02:00
Daniel Marjamäki 1045ece946 dump: refactor valueType dump 2017-04-16 09:11:20 +02:00
Robert Reif bcf0c5f010 Add ValueType and auto type information to debug output.
Print out ValueType for variables and function return type.
Print out complete type for variables and function return type.
Print out ValueType for variable auto token.
2017-04-07 19:57:10 -04:00
Daniel Marjamäki fd2651909c Fixed #7978 (ValueType: container type not set properly) 2017-04-06 07:07:20 +02:00
Daniel Marjamäki fee86b9684 ValueType: Better handling of 'new Container' 2017-04-05 22:05:29 +02:00
Daniel Marjamäki b7dcdc00d0 Fixed #7970 (ValueType: no types set below 'new std::string') 2017-04-01 22:22:37 +02:00
Daniel Marjamäki 1dbf485e02 Fix Cppcheck warnings. Remove redundant null pointer check. 2017-04-01 10:51:45 +02:00
PKEuS ea215c3b7b Fixed false positives in CheckClass::checkConst() due to unmatched function overloads
Fixed function matching if constness mismatches
2017-04-01 10:19:32 +02:00
Daniel Marjamäki 164df2aa7b Fixed #7966 (ValueType: wrong type for gcc initialization {[1]=..}) 2017-03-31 09:41:38 +02:00
Daniel Marjamäki 2da3123db2 Fix ValueType. The '[' in variable declaration is not a dereference. 2017-03-30 11:01:29 +02:00
IOBYTE 7cae057615 Add missing varid or variable for member variables.
Add an optional extended description…
2017-03-30 10:07:58 +02:00
PKEuS 3c8f5b85ae Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10% 2017-03-27 18:48:34 +02:00
Robert Reif c96e8daebc Don't change varid of member variables. 2017-03-25 10:59:35 -04:00
PKEuS f4c0ab5dd5 SymbolDatabase: Match function overloads by using ValueType information by running a second pass of the function pointer assignment routine. 2017-03-24 12:19:29 +01:00
Robert Reif bc87e874e9 Add variable and type information for auto and auto variables in range based for loops of containers. 2017-03-23 20:14:49 -04:00
Robert Reif 7adfb6e0e4 Add variable and type information to tokens for C array range based for loops. 2017-03-23 19:48:20 -04:00
Robert Reif 662bc6f846 Add variable or type information to auto and auto variable tokens. Changing the auto variable type requires rerunning the variable pointer pass to correct the symbol database for the new type. 2017-03-22 22:09:40 -04:00
Robert Reif f099c6a110 Refactor symbol database value type support by making setValueTypeInTokenList and setValueType member functions of SymbolDatabase. Class variables are no longer passed around as parameters but accessed directly which simplifies the code. There should be no functional change. 2017-03-21 21:55:22 -04:00
PKEuS 7c0aa4464c Fixed travis build by replacing Token::Match by simpleMatch()
Added missing files to cppcheck.vcxproj.filters
2017-03-16 21:15:10 +01:00
PKEuS 8a3fb4dd6c SymbolDatabase: Fixed return type token detection for template member functions (#7945) 2017-03-16 20:47:24 +01:00
PKEuS c638180753 Fixed crash in clang test suite introduced in b27ba72fdd 2017-03-15 19:22:42 +01:00
PKEuS bcba27fbb9 SymbolDatabase: Removed unnecessary bailout in function matching for pointers in function overload matching 2017-03-15 18:45:33 +01:00
PKEuS b27ba72fdd SymbolDatabase: Support function overload matching for member variables (#7932) 2017-03-15 18:37:22 +01:00
Daniel Marjamäki e560ad1616 update std::string config 2017-03-05 18:19:49 +01:00
Daniel Marjamäki 6c1096bf71 ValueType: First change to handle 'for (auto i : container)' 2017-03-05 15:40:29 +01:00
Daniel Marjamäki ab7cf5d215 ValueType: set ValueType for method that returns iterator 2017-03-05 14:53:32 +01:00
Daniel Marjamäki fa7501d3a5 ValueType: stl variables should now be handled 2017-03-05 10:33:17 +01:00
Daniel Marjamäki f3c0461001 ValueType: handling scoped types in 'new ...' 2017-03-05 10:24:51 +01:00
Daniel Marjamäki e0dd0a82ed ValueType: refactor and improve handling of 'new ...' 2017-03-05 10:02:47 +01:00
Robert Reif e02b2c4483 ValueType: handle new nothrow 2017-03-05 02:13:00 +01:00
Daniel Marjamäki 115ea08544 ValueType: Allow that type is library-container 2017-03-05 02:09:52 +01:00
Daniel Marjamäki c832b2f40b ValueType: Fixed bug 2017-03-05 01:39:56 +01:00
Daniel Marjamäki 920398615d ValueType: handle scoped types in parsedecl 2017-03-05 01:21:02 +01:00
Daniel Marjamäki 2f2ac46243 Replaced hardcoding for char16_t and char32_t with configuration 2017-03-04 16:30:42 +01:00
Daniel Marjamäki 12fe4a8b3e Fixed #7885 (ValueType: Wrong type for large hexvalue (platform=win32A)) 2017-03-04 14:19:14 +01:00
Daniel Marjamäki ecc59859e1 Don't simplify _Bool in TokenList 2017-03-04 11:13:28 +01:00
Daniel Marjamäki 45c5860ca4 Fixed #7926 (Memory Leak with auto not detected) 2017-03-02 22:24:26 +01:00
Daniel Marjamäki 995d875cb2 SymbolDatabase: Refactoring 2017-03-01 18:09:50 +01:00
Daniel Marjamäki 51b5f1c286 Fixed #7931 (crash: SymbolDatabase: Variable::setFlag) 2017-03-01 17:13:22 +01:00
PKEuS 7eee6af4ce Fixed broken condition 2017-03-01 11:42:14 +01:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
PKEuS d501e488ca Refactorization: Reordered conditions in Scope::findFunction() 2017-03-01 10:27:01 +01:00
PKEuS 85768f1829 SymbolDatabase: Overload matching with boolean literals as argument and with arbitrary null-pointers 2017-02-28 22:43:47 +01:00
PKEuS 942644fde6 SymbolDatabase: Overload matching with character literals as argument 2017-02-28 22:08:41 +01:00
Daniel Marjamäki beaf29c158 SymbolDatabase: Update some properties for auto variables 2017-02-27 23:04:25 +01:00
Daniel Marjamäki 994f6b684d ValueType: initial handling of new 2017-02-27 20:57:28 +01:00
PKEuS 900d05d9dd Optimization: Do not attempt to find a matching function for if, for, while, etc. 2017-02-27 10:35:47 +01:00
Daniel Marjamäki 7ecd5db8fb ValueType: Handle auto in range for loop 2017-02-27 02:09:33 +01:00
Daniel Marjamäki 2da360eec5 ValueType: Handle 'auto *p = ..' 2017-02-26 22:43:10 +01:00
Daniel Marjamäki dad455c0dd ValueType: Handle 'auto'. First fix for #4345 2017-02-26 20:02:57 +01:00
PKEuS c1d8fd7f13 SymbolDatabase: Better handling of pointers in findFunction(), supporting const pointers and std::string overloads 2017-02-26 11:36:04 +01:00
PKEuS 4a27376694 SymbolDatabase: Implement two-stage fallback mechanism for matching function overloads, increasing matching accuracy 2017-02-25 23:12:00 +01:00
PKEuS 3f1e2b4270 More conservative fallback for function overload matching 2017-02-24 20:56:47 +01:00
PKEuS 4e28d40bf0 Fixed matching long long overload to function call f(0) 2017-02-24 20:33:52 +01:00
Robert Reif 8e0f1ec788 Fixed #7909 (Crash in CheckMemoryLeakInClass) 2017-02-20 23:09:35 +01:00
Matthias Krüger 6f1e7e897d simplify if(tok && Token::{simple,}Match) to if(Token::{simple,}Match). 2017-02-06 15:37:12 +01:00
Daniel Marjamäki 7bdd001a5f SymbolDatabase: Removed redundant 'else' 2017-01-09 22:48:05 +01:00
Simon Martin bd92ddd386 Ticket #7850: Properly handle C functions called "class". 2017-01-06 21:16:28 +01:00
Robert Reif 4123b457d7 Fixed #7441 (SymbolDatabase: No scope when function return type not specified) 2017-01-06 11:53:17 +01:00
Daniel Marjamäki a184d5d421 SymbolDatabase: Refactoring 2017-01-01 11:34:05 +01:00
Daniel Marjamäki 4558701c08 varid: don't generate varid and symboldatabase variable for function call parameter 2016-12-18 20:16:38 +01:00
Daniel Marjamäki 17aaecbd6b ValueFlow: Improved handling of sizeof 2016-12-18 14:03:48 +01:00
PKEuS cfac3b457d Several small refactorizations 2016-12-06 22:12:02 +01:00
PKEuS 6e8ac13325 Refactorization:
- Optimized std::string usage
- Replaced list by vector
- Moved iterator into loop head
- Ran AStyle
2016-12-05 17:45:34 +01:00
Daniel Marjamäki c12cb69cc2 ValueType: Handle function pointers 2016-12-04 16:02:50 +01:00
PKEuS 36d12d7866 SymbolDatabase: Function::retDef should not point at "static" or "extern" 2016-11-28 17:23:39 +01:00
Matthias Krüger b3ace258ab there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already. 2016-11-26 17:22:30 +01:00
Frank Zingsheim c8ff96fe8f Fixed #6180 (Usage of variable after std::move or std::forward) 2016-11-20 15:14:49 +01:00
Daniel Marjamäki 1235815ae9 SymbolDatabase: refactoring condition 2016-11-18 22:01:15 +01:00
Daniel Marjamäki 2f27a0c8f6 Revert "SymbolDatabase: refactoring condition"
I don't see why, but this did not work well on appveyor.

This reverts commit 5d7a4d51ad.
2016-11-17 22:53:03 +01:00
Daniel Marjamäki 79fc332511 Fixed #7810 (SymbolDatabase: method with redundant scope info) 2016-11-17 22:45:50 +01:00
Daniel Marjamäki 5d7a4d51ad SymbolDatabase: refactoring condition 2016-11-17 22:20:01 +01:00
Daniel Marjamäki 0e9810b7f6 CheckStl: validation of iterators returned from functions 2016-11-01 14:08:42 +01:00
Daniel Marjamäki f973a9a9d5 SymbolDatabase: Refactoring handling of library-function return type 2016-10-23 23:20:36 +02:00
Daniel Marjamäki c8f831b70d Library: Allow that type of function return is specified. Fixes #7668. 2016-10-23 23:04:15 +02:00
Robert Reif f25d205999 Fixed #7767 (SymbolDatabase: function not analysed when unknown macros are in front of function definition) 2016-10-22 22:29:18 +02:00
Daniel Marjamäki c70987b727 ValueType: fix type of integer literals 2016-10-16 11:36:22 +02:00
Robert Reif bf7ef56ef5 Fixed #7713 (False positive: %hhu in format string (no. 1) requires 'unsigned char' but the argument type is 'signed int'.) 2016-08-26 19:47:36 +02:00
Frank Zingsheim 8c8a534117 SymbolDatabase: stronger type matching 2016-08-21 16:11:23 +02:00
Robert Reif 1dd1f6dd6a Fixed #7673 ((debug) Executable scope 'foo' with unknown function.) 2016-08-20 17:56:48 +02:00
Daniel Marjamäki 8a66535399 Fixed #7694 (ValueType: 1.23L) 2016-08-20 08:44:53 +02:00
Robert Reif b56c765a45 Fixed #7703 ((debug) Executable scope 'foo' with unknown function.) 2016-08-20 07:43:15 +02:00
Robert Reif 1e999e0cfe Fixed #7697 ((debug) Executable scope 'B' with unknown function.) 2016-08-19 19:06:15 +02:00
Robert Reif 73e1378af8 Fixed #7661 (False positive: Function parameter 'e' should be passed by reference.) 2016-08-13 21:25:57 +02:00
Robert Reif fc1a755100 Fixed #7666 (Executable scope with unknown function.) 2016-08-09 14:02:06 +02:00
Robert Reif cdfe92b753 Fixed #7657 (False positive: Function parameter 'c' should be passed by reference.) 2016-08-06 10:27:00 +02:00
Robert Reif 55b3f0bf38 Fixed #752 (SymbolDatabase: Does not match function if redundant keywords mismatch (C++)) 2016-08-04 09:06:32 +02:00
Dmitry-Me 7f30108f1d Descriptive variable name 2016-08-03 18:15:08 +03:00
Robert Reif b40edca62f Fixed #7387 (SymbolDatabase: Wrong overloaded function is picked) 2016-08-02 23:34:11 +02:00
Robert Reif b9030bcfcd Fixed #7650 (SymbolDatabase: Wrong Token::type(), enum and class with same name) 2016-08-02 23:30:46 +02:00
Robert Reif b44f448acc Fixed #7649 (SymbolDatabase: Wrong overloaded function is picked for char and wchar_t) 2016-08-02 18:54:01 +02:00
Robert Reif 612e83d5af SymbolDatabase: Small fix 2016-08-02 14:31:07 +02:00
Robert Reif 891e21b478 Fixed #7458 (SymbolDatabase: Wrong overloaded function is picked) 2016-08-02 08:58:11 +02:00
Daniel Marjamäki 09b6568ea2 Fixed #7646 (podtypes do not get proper valuetype) 2016-07-31 19:47:34 +02:00
PKEuS fc1603eb9b MathLib, ValueType: Support integer suffix "i64" 2016-07-26 13:19:53 +02:00
Matthias Krüger 6fd8edd6e5 Symboldatabase::sizeOfType: fix crash; fixes #7615 2016-07-26 01:18:47 +02:00
PKEuS 045116f797 Optimized SymbolDatabase::findVariableType(). 2016-07-25 18:33:22 +02:00
PKEuS 2e2800f5bd Fixed several MSVC warnings 2016-07-24 12:36:36 +02:00
Daniel Marjamäki a68da1a725 ValueType: Set valuetype for sizeof argument 2016-07-20 09:39:48 +02:00
Daniel Marjamäki 0ddeac0429 refactor (use ast) and improve CheckOther::checkRedundantAssignment (warn about global variables unless they are volatile, handle arrays in lhs better) 2016-07-18 12:43:23 +02:00
PKEuS 801fd8f96a Support trailing return types (C++11) 2016-07-17 15:47:50 +02:00
Robert Reif c1594bedbb Fixed creation of SymbolDatabase for some template code (#7594) 2016-07-09 09:22:52 +02:00
PKEuS 44a19b527e Use ValueFlow and SymbolDatabase to detect buffer overflows with new and malloc, improving support for enums (#7576) 2016-07-08 20:53:08 +02:00
Robert Reif eca805ba3b ValueFlow: Fixed constant folding of sizeof(enum) and sizeof(enumerator) (#7564) 2016-07-08 20:39:34 +02:00
Robert Reif 583b340034 enum: set the return type of derived class functions returning enums defined in a base class. 2016-06-05 14:08:33 +02:00
Robert Reif f4dd43a71a Fixed #7523 (Scope::findEnumerator(): does not find enum constant from other enum type) 2016-05-29 14:45:45 +02:00
Daniel Marjamäki 2417f72c5e Silence Travis 2016-05-26 18:31:52 +02:00
Daniel Marjamäki 54be403f64 Fixed #7026 (Cppcheck does not recognizes the use of a variabile inside lambda function) 2016-05-26 18:07:56 +02:00
Daniel Marjamäki 38741868b5 Fixed #3989 (false positive: memory leak (inline function)) 2016-05-26 17:42:27 +02:00
Daniel Marjamäki 8b088a472f SymbolDatabase: Refactoring 2016-05-26 12:04:18 +02:00
Daniel Marjamäki f45233682e SymbolDatabase: Code cleanup 2016-05-26 12:00:03 +02:00
Robert Reif 66cacde3db Fixed #7513 (value flow of array dimension with enum doesn't always work) 2016-05-26 11:25:50 +02:00
PKEuS c7b3836379 Small refactorizations:
- Optimized performance of several functions by adding pre-checks
- Simplified some code
- Fixed VS warning in testsymboldatabase.cpp
2016-05-25 15:30:49 +02:00
Daniel Marjamäki ae97f53244 Fixed #6184 (ValueType: overloaded < operator) 2016-05-25 13:56:36 +02:00
Matthias Krüger 0556edd151 fix #7505 (crash on invalid code) 2016-05-25 13:14:34 +02:00
Daniel Marjamäki 684966f674 Fixed #7509 (ValueType: wrong type for container element - std::array) 2016-05-24 09:07:38 +02:00
Daniel Marjamäki 397480f929 Fixed #7376 (ValueType: wrong type for container element) 2016-05-23 18:53:59 +02:00
Daniel Marjamäki b7b92b2140 Fixed #6674 (false positive 'unusedPrivateFunction' - calling virtual function in subclass) 2016-05-21 20:07:35 +02:00
Daniel Marjamäki 7591a57587 Removed redundant valuetype debug output 2016-05-14 20:11:57 +02:00
Robert Reif 5631c765a7 SymbolDatabase: better handling when array size is given with expression involving enum constants. 2016-05-13 11:40:19 +02:00
Robert Reif 97bbb7da0d Fixed #7476 (SymbolDatabase: Wrong data with single ; in line) 2016-05-12 11:35:02 +02:00
Daniel Marjamäki 8a13b5cd83 Fix Cppcheck warning 2016-05-09 13:08:00 +02:00
Daniel Marjamäki 9c8922541e Avoid C++11 for-range to make AppVeyor happy 2016-05-09 13:05:08 +02:00
Robert Reif 381fa53ec6 SymbolDatabase: better handling of enum values 2016-05-09 12:40:56 +02:00
Daniel Marjamäki eac3660f46 ValueType: Changed type info for enums to 'signed int', that is what checks wants to see mostly. 2016-05-09 11:11:13 +02:00
Daniel Marjamäki e99a9b4742 SymbolDatabase: Fix cleanup (avoid dead pointers) 2016-05-08 18:34:23 +02:00
Daniel Marjamäki 7edb1bc2e2 Fixed #7484 (ValueType: crash with --debug --verbose) 2016-05-08 17:43:34 +02:00
Daniel Marjamäki e355e4ac78 ValueType: Refactoring 2016-05-08 17:42:53 +02:00
Daniel Marjamäki 803b4d4cf8 ValueType: Better handling of nested types 2016-05-08 14:55:10 +02:00
Daniel Marjamäki 636e97c272 ValueType: Improved debug output for nested types 2016-05-08 13:15:20 +02:00
Daniel Marjamäki f0953c6916 ValueType: better handling of nonstandard types 2016-05-08 11:55:25 +02:00
Daniel Marjamäki be90080976 Fixed #7481 (False positive AssignmentAddressToInteger - pointer to enum) 2016-05-07 19:51:37 +02:00
PKEuS 3366a74bb0 Refactorized CheckCondition::clarifyCondition():
- Reimplemented parts of the check based on ValueType
- Merged two loops

Fixed some type conversion messages
2016-05-06 15:22:45 +02:00
PKEuS 0bf85f9aa5 ValueType: Support integers defined in libraries (#7394) 2016-05-04 15:39:56 +02:00
PKEuS 6c3f0a7bb8 SymbolDatabase: Properly detect lambdas with return type (#7473) 2016-05-04 14:10:09 +02:00
amai2012 a54ec615f3 Run astyle 2016-04-25 11:12:35 +02:00
amai2012 479f00030e Restore compatibility with current C++ language set specification (VS2010) 2016-04-24 23:02:56 +02:00
Daniel Marjamäki 0635ceb42a Replaced C++11 auto keyword 2016-04-23 09:18:28 +02:00
Robert Reif ee2be81fae enums: Fix false negatives caused by new enum handling 2016-04-22 20:26:58 +02:00
Daniel Marjamäki dc2a92263a Fixed #7426 (RFC: time to replace simplifyEnum?) 2016-04-22 06:02:54 +02:00
Robert Reif 47634a0ada Fixed #7420 ((debug) Executable scope 'foo' with unknown function.) 2016-03-22 14:10:20 +01:00
Daniel Marjamäki 4e4873772d Fixed #7395 (ValueType: Result type of assignment operators) 2016-03-21 19:51:09 +01:00
Daniel Marjamäki d964825c9f ValueType: Add debug output that is shown when --verbose is used 2016-02-15 16:18:24 +01:00
PKEuS 0847d3d19a ValueType related bugfixes:
- ptrdiff_t is SIGNED
 - Detect pointers to unknown types as pointers
 - Do not identify bool* as boolean (#7381)
2016-02-05 20:29:17 +01:00
PKEuS 618ea498e9 ValueType: Support logical operators 2016-02-05 15:15:13 +01:00
PKEuS 35317695d4 ValueType: Fixed handling of constness 2016-02-05 13:31:31 +01:00
PKEuS 792835cd9a ValueType: Support ++/--. 2016-02-05 12:06:44 +01:00
PKEuS 2b179dc836 ValueType: Properly support ternary operator with pointers (#7378) 2016-02-05 09:59:48 +01:00
PKEuS 3b7948fb4e ValueType: Support ternary operator 2016-02-04 21:20:05 +01:00
PKEuS a9f52aec04 ValueType: Support unary arithmetical/bit operators 2016-02-04 21:03:54 +01:00
PKEuS cae19cadd3 ValueType: Added support for static member variables and simplified code 2016-02-04 20:49:13 +01:00
Alexander Mai d3546ea410 #7321 segmentation fault in valueFlowSwitchVariableScope::isVariableDeclaration 2016-02-03 22:49:57 +01:00
Alexander Mai cfe9c01bf8 #7257 segmentation fault in valueFlowSwitchVariable (invalid code). Correct SymbolDatabase::validateVariables() so it does not complain about function arguments for function without body 2016-02-03 21:52:02 +01:00
Alexander Mai d45f5c94cb Add (disabled) function in SymbolDatabase to check variable list (e.g. find variables w/o scope). Fix some doxygen warnings. 2016-02-03 17:08:46 +01:00
PKEuS 841f17776b Set ValueType for assignment operators, detect division by zero for %= and /= again (#7322) 2016-02-02 17:17:55 +01:00
PKEuS d19b5031fa Refactorization: Removed unused function. 2016-02-02 11:46:42 +01:00
Daniel Marjamäki 988918c9bc ValueType: Use signed as default sign for short/int/long/longlong 2016-01-31 14:34:26 +01:00
Daniel Marjamäki 0e89620212 Fixed #4698 (False positive: Uninitialized member variable warning with confusing namespaces) 2016-01-30 14:04:48 +01:00
Daniel Marjamäki 3d0338e9f9 Fixed #7212 (incorrectly adding function argument with no name) 2016-01-23 09:48:21 +01:00
Daniel Marjamäki f64930b7f5 Fixed #7343 (SymbolDatabase: handling of override) 2016-01-22 19:22:24 +01:00
Daniel Marjamäki a014920280 Fixed #7260 (ValueType: in C++ the result of 'sint >> unknowntype' has unknown type) 2016-01-07 10:46:19 +01:00