Commit Graph

525 Commits

Author SHA1 Message Date
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 f8dd6ee014 Fix test code so it compiles. 2017-03-23 19:16:15 -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
PKEuS 8a3fb4dd6c SymbolDatabase: Fixed return type token detection for template member functions (#7945) 2017-03-16 20:47:24 +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 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 920398615d ValueType: handle scoped types in parsedecl 2017-03-05 01:21:02 +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 45c5860ca4 Fixed #7926 (Memory Leak with auto not detected) 2017-03-02 22:24:26 +01:00
Daniel Marjamäki 51b5f1c286 Fixed #7931 (crash: SymbolDatabase: Variable::setFlag) 2017-03-01 17:13:22 +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
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
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 4558701c08 varid: don't generate varid and symboldatabase variable for function call parameter 2016-12-18 20:16:38 +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
Daniel Marjamäki 21364b4401 Refactoring fix for #7816 2016-11-21 13:54:59 +01:00
Daniel Marjamäki 74fa69fe5e Fixed #7821 (syntax error, first token is &) 2016-11-20 17:59:50 +01:00
Daniel Marjamäki 5b377ea2e4 Fixed #7821 (segmentation fault, invalid last token) 2016-11-20 14:15:51 +01:00
Daniel Marjamäki 79fc332511 Fixed #7810 (SymbolDatabase: method with redundant scope info) 2016-11-17 22:45:50 +01: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 4587dfffd8 Fix -Wshadow warnings 2016-10-17 15:45:16 +02:00
Daniel Marjamäki 5175bf88d6 Platform: Fix type limits calculations. sizeof=>bit 2016-10-16 12:00:33 +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
Robert Reif 62ac40fc5e Fixed #7706 ((debug) Executable scope 'foo' with unknown function.) 2016-08-20 22:43:27 +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
Daniel Marjamäki fe3abd678f Revert "Fix potential null pointer dereference"
This reverts commit 6ca76ff965.
2016-08-04 10:40:07 +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 6ca76ff965 Fix potential null pointer dereference
This was CID 1360399
2016-08-03 18:44:15 +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 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
Daniel Marjamäki 9082c097c8 Fixed testing of #7615. The code is not garbage so move it from TestGarbage to TestSymbolDatabase 2016-07-26 09:10:10 +02:00
PKEuS 2e2800f5bd Fixed several MSVC warnings 2016-07-24 12:36:36 +02:00
Daniel Marjamäki f50f024873 Revert "Resolve CID 1357639"
This reverts commit e3b0c3a974.

It's not a proper fix. I want that Cppcheck detects this bug also. I want to keep the CID open until Cppcheck can detect it.
2016-07-21 09:52:51 +02:00
Dmitry-Me e3b0c3a974 Resolve CID 1357639 2016-07-21 10:34:07 +03:00
Daniel Marjamäki a68da1a725 ValueType: Set valuetype for sizeof argument 2016-07-20 09:39:48 +02:00
PKEuS 801fd8f96a Support trailing return types (C++11) 2016-07-17 15:47:50 +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
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
Daniel Marjamäki 397480f929 Fixed #7376 (ValueType: wrong type for container element) 2016-05-23 18:53:59 +02:00
Daniel Marjamäki df6a66deed SymbolDatabase: Add test that makes sure enum constant values are calculated properly. Related with ticket #7493. 2016-05-12 12:07:40 +02:00
Daniel Marjamäki a167a2d242 TestSymbolDatabase: Add some tests for the new enum handling 2016-05-09 18:34:24 +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 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 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
PKEuS b65cacf4b1 Tokenizer::simplifyStaticConst(): Support "struct" and operator:: (#7403) 2016-05-04 12:33:19 +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
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
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
Daniel Marjamäki 58e28cb00e ValueType: Better handling of unsigned unknown types 2016-01-05 19:47:11 +01:00
Daniel Marjamäki 8dccbfefcf ValueType: handle lowercase number suffix, for instance '0ll' 2016-01-03 13:34:47 +01:00
Robert Reif db6dfa2d22 Fixed #7195 (crash: valueFlowSwitchVariable()) 2016-01-02 18:53:51 +01:00
Daniel Marjamäki 95009a4630 Merge pull request #745 from lanurmi/2016_ad
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki b457ceef0e Settings: Added defaultSign 2016-01-01 17:33:59 +01:00
Daniel Marjamäki 2f26195b23 Fixed #7248 (crash in ValueType::str()) 2016-01-01 15:13:50 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki e69e952c46 Fixed #7245 (ValueType: Wrong result type for 'sint << uint') 2015-12-31 20:18:35 +01:00
Daniel Marjamäki fdcab8f1bb ValueType: better handling of struct member 2015-12-30 11:36:46 +01:00
Daniel Marjamäki c5c386ceb8 ValueType: Handle void pointers 2015-12-29 19:58:51 +01:00
Daniel Marjamäki 32455e8441 Fixed #7214 (ValueType: does not handle static_cast) 2015-12-26 15:20:17 +01:00
orbitcowboy ad17a0d721 testsymboldatabase: Improved constness of local variable. 2015-12-15 13:29:58 +01:00
orbitcowboy d93f2994d4 testsymboldatabase: Removed useless call of GetSymbolDatabase. 2015-12-15 13:11:20 +01:00
PKEuS eb27d3b877 Refactorization: Moved condition out of loop and ran AStyle 2015-12-06 10:40:22 +01:00
Alexander Mai 98f2cd021e #7199 SymbolDatabase::validate() should be run in debug mode and print debug messages. In turn correct some test examples with invalid code. 2015-12-06 08:14:04 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
PKEuS 93c02ce826 Fixed compiler error introduced in previous commit and several MSVC warnings 2015-11-28 10:49:08 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Daniel Marjamäki ca8b15cd6b Fixed #7124 (int32_t etc are recognised as fundamental types, but std::int32_t etc are not) 2015-11-15 17:51:27 +01:00
PKEuS fdb596fa05 Do not set "pure" flag if function is declared as "= default" (#7101) 2015-11-07 22:21:50 +01:00
PKEuS eb2b0fa0d0 Fixed wrongly detected unconditional scope with C++11-style initialization in SymbolDatabase (#6581) 2015-11-06 10:16:44 +01:00
PKEuS 24882fb53a Fixed VarId accidentially assigned to case labels. 2015-10-26 21:24:53 +01:00
PKEuS dfdc0f6b99 Support range-based for-loop in SymbolDatabase 2015-10-26 19:20:42 +01:00
Daniel Marjamäki ac9cb87e04 ValueType: Handle bit operations, sizeof better. Use ValueType in astIsFloat(). 2015-10-11 12:20:40 +02:00
Daniel Marjamäki 5b082aa799 ValueType: struct member 2015-10-11 10:48:08 +02:00
Daniel Marjamäki 9738cc66eb ValueType: function return type 2015-10-11 08:42:31 +02:00
Daniel Marjamäki cf179f82b6 ValueType: Better handling of wide strings 2015-10-11 08:13:30 +02:00
Daniel Marjamäki 0849ad4707 ValueType: Better handling of const 2015-10-10 08:32:45 +02:00
Daniel Marjamäki a500f6f703 Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better. 2015-10-08 19:50:10 +02:00
PKEuS 856e4c414d Refactorization: Reduced code duplication in testsymboldatabase.cpp 2015-10-08 12:53:56 +02:00
Daniel Marjamäki 2fd27ff729 ValueType: Test promotions 2015-10-07 19:50:33 +02:00
Daniel Marjamäki 604a9acb48 ValueType: Handling constness 2015-10-07 19:08:26 +02:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
Daniel Marjamäki db31e22316 ValueType: Improved signedness 2015-10-07 18:10:48 +02:00
Daniel Marjamäki b9036c2ca8 AST types: Fix for 'long long' handling 2015-10-05 19:20:42 +02:00
Daniel Marjamäki f35c24d4af SymbolDatabase: Better handling of valuetypes in AST 2015-10-04 23:27:58 +02:00
Daniel Marjamäki 9b253612ca SymbolDatabase: Add type information in AST 2015-10-04 19:42:58 +02:00
Simon Martin 101cebbde1 Ticket #6957: Properly handle arrays of pointers in CheckClass::constructors. 2015-08-28 23:06:39 +02:00
Simon Martin 6fb19b02d0 Properly differentiate arrays of pointers and pointers to arrays. 2015-08-25 21:19:19 +02:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Alexander Mai 6e03e7dca2 Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0. Run astyle 2015-07-01 07:50:13 +02:00
amai2012 480a5672b0 #6298 stack overflow in Scope::findFunctionInBase (endless recursion). Fix handling of circular class hierarchy 2015-07-01 00:04:01 +02:00
Simon Martin 50e5595845 Ticket #6708: Check that a function name is not a reserved keyword in SymbolDatabase::isFunction instead of later. 2015-05-26 00:28:08 +02:00
amai2012 7c23f4e611 Merge pull request #596 from simartin/ticket_6620-6685
Ticket #6620, #6685: Reserved keywords cannot be function names.
2015-05-23 13:47:07 +02:00
Alexander Mai e8d84bc6b4 #6700 const vs non-const inside assert() statement. Function matching in symboldatabase did not honor const'ness of a class instance variable 2015-05-23 11:56:11 +02:00
Simon Martin 67eab0cd7c Ticket #6620, #6685: Reserved keywords cannot be function names. 2015-05-23 11:29:58 +02:00
Alexander Mai f0bc300198 #6510 False positive performance warning for std::list::size(). Fix this and other similar false positives. Refactoring of Variable::isStlType(), use fail-safe std::set instead of plain array. Run astyle 2015-05-17 20:02:41 +02:00
PKEuS 0d127f15a5 Fixed grammar mistake; fixed two VS2013 code analysis messages; removed redundant Token::Match call 2015-03-15 10:06:56 +01:00
Alexander Mai 21ab4413aa Fix compiler warnings 2015-03-05 20:49:42 +01:00
Robert Reif 130ffc5752 Fixed #6538 (Symboldatabase: improve isFunction) 2015-02-24 06:11:31 +01:00
Daniel Marjamäki 830d1eb3fd Revert "Fixed #6538 (Symboldatabase: improve isFunction)"
This reverts commit d7ef89bbe6.

There was crashes in a Travis job.
2015-02-23 08:07:19 +01:00
Robert Reif d7ef89bbe6 Fixed #6538 (Symboldatabase: improve isFunction) 2015-02-23 06:49:50 +01:00
PKEuS 6227abac73 Fixed GCC (testsymboldatabase.cpp) and MSVC (checkother.cpp) warnings 2015-02-18 21:19:36 +01:00
PKEuS 27924d4ae2 Improved detection of array dimensions (#6430) 2015-01-31 13:12:06 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
PKEuS dcc1362890 SymbolDatabase: Support std::array (fixes #6401) 2015-01-30 21:56:27 +01:00
Dmitry-Me 6c248dd1ac Resolve CID 1265723 2015-01-23 17:53:39 +03:00
Robert Reif 56dc0b02ef Fixed #6432 (cppcheck fails to detect ctor - partial template specialization) 2015-01-19 16:15:11 +01:00
Robert Reif 3b8540fdc0 Fixed #6424 (false negative: Use of 'class Ns::C' silence Cppcheck) 2015-01-19 06:38:54 +01:00
Thomas Jarosch 08985bf68a Throw exception in getVariableFromVarId() if called with out_of_range varId
That way we have a chance to catch code bugs at all.
2015-01-15 18:52:11 +01:00
Thomas Jarosch 1cc85bfce3 Add bounds check to getVariableFromVarId()
While poking around the memory leak check,
I managed to trigger an out-of-bounds access
in the symbol database.

Fix it by sanity checking the variable id
passed to getVariableFromVarId().
2015-01-14 23:00:38 +01:00
Robert Reif 68bb197bcb Destructor detected as constructor resulting in false variable not initialized warnings 2015-01-12 06:11:22 +01:00
PKEuS 7452613479 Refactorization:
- Merged messages exceptThrowInNoexecptFunction, exceptThrowInNoThrowFunction, exceptThrowInAttributeNoThrowFunction and exceptThrowInDeclspecNoThrowFunction into a single message.
- Merged Token::fIsDeclspecNothrow into Token::fIsAttributeNothrow
2015-01-09 20:18:09 +01:00
Robert Reif ba1c24ee65 Fixed #6422 (symbol database: put function flags into a single flag variable) 2015-01-08 05:45:31 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS ff5ede342b Fixed #6266: Support noexcept(false) 2014-12-09 23:53:50 +01:00
PKEuS e9bc3b7acf Fixed #6308: Properly associate Function with Scope for destructors in SymbolDatabase 2014-12-09 21:36:09 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
Alexander Mai 1c191845fb Fix invalid assertion from recent commit. Make single argument givenACodeSampleToTokenize ctor explicit. 2014-11-18 19:52:06 +01:00
Alexander Mai 85c02df56c Fix compiler warning. run astyle 2014-11-18 19:36:47 +01:00
Alexander Mai 0ba3c15c52 Cure null pointer access within Scope::findFunction introduced by recent cs 2014-11-17 23:05:15 +01:00
Robert Reif c5e15950df Fixed #6230 (SymbolDatabase: Wrong function() is set for token) 2014-11-17 16:04:44 +01:00
Daniel Marjamäki 189dfd64f7 Revert "Fixed #6230 (SymbolDatabase: Wrong function() is set for token)"
This reverts commit 685fce6b91.
2014-11-11 07:29:16 +01:00
Daniel Marjamäki 685fce6b91 Fixed #6230 (SymbolDatabase: Wrong function() is set for token) 2014-11-07 11:10:20 +01:00
Robert Reif 1f32e9eee5 Symbol database: added test for findfunction 2014-11-07 10:46:31 +01:00
Robert Reif df6855c216 SymbolDatabase: reintroduce test, move symboldatabase cleanup code to SymbolDatabase destructor 2014-11-02 10:36:52 +01:00
Robert Reif 4eb33e7479 SymbolDatabase: Refactoring of findFunction 2014-11-01 14:36:17 +01:00
PKEuS 9a755714b5 Removed unused function from testsymboldatabase.cpp 2014-10-16 11:12:28 +02:00
PKEuS 6955e719cf Collected garbage code tests and moved them to testgarbage.cpp 2014-10-16 10:59:46 +02:00
Robert Reif 45a2986f34 Added test for #6171 2014-10-15 21:41:15 +02:00
Daniel Marjamäki 77cffcde38 Fixed #6190 (SymbolDatabase: variable info not set properly when reinterpret_cast is used) 2014-10-12 16:06:50 +02:00
PKEuS 448195f255 Added variable name to debug message about typeStartToken()
Fixed cppcheck message
2014-09-29 14:36:03 +02:00
PKEuS 0ae09c0029 SymbolDatabase: A token with a varId cannot be a function declaration 2014-09-29 13:05:51 +02:00
Simon Martin 0222c50d4a Make TestSymbolDatabase::hasClassFunction's code snippet valid. 2014-09-20 14:51:58 +02:00
PKEuS e8f7279039 Refactorization: Moved detection of STL strings to SymbolDatabase 2014-09-05 12:03:08 +02:00
PKEuS 6d27ca6c9a Fixed SymbolDatabase if unnamed struct is casted and returned (#6125) 2014-09-03 11:15:05 +02:00
PKEuS 862b18e0e2 SymbolDatabase: New scope type eLambda 2014-08-31 10:21:27 +02:00
PKEuS 5d302716e7 Refactorized Variable::isIntegralType() and Variable::isFloatType():
- Cached property
- Make use of it in several checks
- float* is flagged as floating point type
2014-08-09 11:45:13 +02:00
PKEuS f3e0df7501 Support C++11 style initialization with {}:
-> Support in setVarId and SymbolDatabase (#4344)
-> Fixed false positives in unused variable checking (#5491, #5494)

Side-effect: Support global variables initialized with brackets (C++03 style) in SymbolDatabase
2014-08-05 15:33:57 +02:00
PKEuS e13de2681e SymbolDatabase: 'const' can't be the name of a variable - fix use after free #5882 2014-06-26 09:19:57 +02:00
Robert Reif e5ae575ace Fixed #5867 (invalid debug warnung: Scope::checkVariable : varid0) 2014-06-02 06:18:32 +02:00
orbitcowboy 27cee5caa5 Fixed CID 1216439: potential copy&paste error in testing symbol database. 2014-05-28 17:05:42 +02:00
PKEuS 04f3caf8e8 Fixed debug message #5159 2014-05-25 14:16:03 +02:00
PKEuS 4f61e9783b Fixed VS warnings in testsymboldatabase.cpp 2014-05-25 14:16:03 +02:00
Alexander Mai 2c8087e34f #4375 New check: add style warning about 'double d=false;' Add a new check to CheckBool. Also implement Variable::isFloatingType() 2014-05-24 18:35:49 +02:00
Robert Reif e993e2927c Fixed #5831 (FP in 1.65: call of pure virtual function 'throw' in destructor) 2014-05-20 06:10:34 +02:00
PKEuS 5fbd58d98d Fixed messages of CheckInternal, fixed a false positive. 2014-05-18 20:39:52 +02:00
Robert Reif ae96491d6c Fixed #5756 (declspec(nothrow) not supported) 2014-05-04 20:47:20 +02:00
Robert Reif 6ff5de2118 Fixed #5697 (Check for throw in __attribute__((nothrow)) function) 2014-04-20 20:40:55 +02:00
Daniel Marjamäki 79942df842 Fixed #5602 (false positive on std::vector - after unknown macro around the function header) 2014-04-13 13:05:30 +02:00
Daniel Marjamäki 1252c70449 Symbol database: tweaked tests 2014-04-12 20:02:34 +02:00
Daniel Marjamäki 9d51bfd015 Fixed #5397 (False positive: Same expression on both sides of '&') 2014-04-12 16:06:31 +02:00
PKEuS 9c921ab657 Fixed handling of member function pointers in setVarId and SymbolDatabase (#4577) 2014-04-12 12:04:55 +02:00
PKEuS e39b89efc3 Throw more syntaxErrors from SymbolDatabase, fixing #5663 2014-04-10 20:11:03 +02:00
Robert Reif 847d28d283 Fixed #5638 (is there any plan to check noexcept correctness?) 2014-04-10 16:17:10 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
PKEuS e0574feabd Fixed problems with unknown macros for inline class methods in SymbolDatabase (#5621) 2014-03-31 21:04:01 +02:00
PKEuS 025850d961 Support unknown THROW()-style macros in symboldatabase; Fixed #5056.
Simplified related code.
2014-03-31 20:33:01 +02:00
PKEuS 345a80f4d5 Fixed #5621 and slightly simplified symboldatabase code. 2014-03-30 11:06:44 +02:00
PKEuS a16d631813 Further improvements to setVarId and function/array pointer detection in SymbolDatabase (#2872) 2014-03-28 17:43:40 +01:00
PKEuS a6ca3cf2cf Throw syntaxError when encounter one in symboldatabase (fixes #5572) 2014-03-27 19:06:13 +01:00
PKEuS 9b4b90f6a0 Avoid loading libraries multiple times in test suite
-> Massive speedup for test suite (especially on slow systems)
2014-03-24 09:59:05 +01:00
PKEuS 1be7bfa7fe Fixed crash on invalid code (#5603) 2014-03-23 20:08:16 +01:00
Alexander Mai 37befc75ef In case of a loop within the class hierarchie Function::isImplicitlyVirtual_rec() was entering an endless loop. Tracking the previously analyzed types shall prevent this. 2014-03-22 08:49:28 +01:00
Daniel Marjamäki ed9153ee80 Symbol database: added simple mismatch check in Scope::findFunction when passing address to function that expects a reference 2014-02-19 06:35:51 +01:00
Lauri Nurmi 70a67eaf85 Change some more 0 literals into nullptr. 2014-02-16 13:38:50 +02:00
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Lucas Manuel Rodriguez 2048313915 Add Variable::isStlType function 2014-01-28 11:44:56 -03:00
Daniel Marjamäki 36acfb6d20 Fixed Cppcheck warning. db is dereferenced before its checked against NULL 2014-01-17 18:10:10 +01:00
Matthias Krüger 3602cc2f6a testsymboldatabase: run symboldatabase32, probably someone forgot to implement this. 2014-01-10 21:08:11 +01:00
XhmikosR 96b62c6ccb Fix the C4800 warnings. 2014-01-09 16:58:42 +02:00
Alexander Mai 77362fd671 Fixed #5289 (Crash: Stack overflow in isImplicitlyVirtual_rec when checking SVN) 2014-01-05 19:10:16 +01:00
Daniel Marjamäki 32be4094e7 Symbol database: only put variables in variable list 2013-12-31 17:51:56 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Robert Reif 43f00942dd Fixed #5197 (SymbolDatabase: bad handling of unknown macros in function declaration) 2013-11-25 03:43:39 +01:00
Daniel Marjamäki f8cf64afef Fixed #4710 (Template parser bug: const in constructor changes template names) 2013-11-19 06:07:25 +01:00
Robert Reif 52df31b501 Fixed #5153 ((debug) Scope::checkVariable found variable ')') 2013-11-08 12:56:32 +01:00
Simon Martin 463ef2e71e Ticket #5120: New test case, that works now that #5125 is fixed 2013-10-30 10:15:03 +01:00
Simon Martin 052be76635 Ticket #5125: Avoid infinite recursion for recursive class definitions 2013-10-29 21:41:47 +01:00
Daniel Marjamäki 4a02ca8202 SymbolDatabase: handle method with unknown macro 'void f() MACRO {..}' 2013-09-28 11:44:26 +02:00
PKEuS 6b47ed414a Fixed Function::retDef initialization:
- Move/Copy Constructors and Destructors do not have a return type neither
- Fixed crash in SymbolDatabase::printOut
- Added testing
2013-09-03 10:48:01 +02:00
Robert Reif 914893013e Symbol Database: improved type handling. Ticket: #4952 2013-08-17 18:43:15 +02:00
Robert Reif b777388fb8 Symbol database: improved type handling (fix problems in previous commit). Ticket: #4952 2013-08-16 05:42:12 +02:00
Robert Reif cd3044c808 Fixed #4952 (SymbolDatabase: unknown types in log file) 2013-08-12 06:21:03 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Daniel Marjamäki 37716fb8bb Tokenizer: Set variable() pointer for array members 2013-07-20 17:46:39 +02:00
Roman Zaytsev Borisovich 295869a866 Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892) 2013-07-09 13:10:03 +04:00
Alexander Mai 0be1892b92 Fixed #4806 (Crash in Type::initBaseInfo() in clang testcode) 2013-06-16 21:46:01 +02:00
Daniel Marjamäki 4e816e2edf astyle formatting 2013-06-09 16:04:59 +02:00
Roman Zaytsev Borisovich 4610b135dc Fixed #4694 2013-06-07 10:37:33 +04:00
PKEuS b58e1241dc Distinguish between different swprintf overloads. (#4790)
Fixed MSVC warning recently introduced
2013-05-14 02:06:16 -07:00
PKEuS 1903585ea3 Fixed bug in handling rvalue references: Scope has to be set everywhere. (#4732) 2013-05-14 01:43:32 -07:00
PKEuS eb2962792f Implemented support for move constructors:
- Changed behaviour of Token::function - is now also set for declarations
- Resolved TODO in testclass.cpp
- removed redundant code in Scope::findFunction - it is safe to call nextArgument() on functions without arguments
- Use Token::function in checkother.cpp
2013-04-04 10:53:55 -07:00
PKEuS 188096665c Implemented support for rvalue references (C++11):
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.

Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Robert Reif 3f57b5a6ca Fixed #4682 (using 'struct' disables checking) 2013-03-28 06:36:49 +01:00
Ettl Martin 1b9c1c03fa unittests: removed not needed '\n' at the end of testcases. 2013-03-20 15:36:16 +01:00
PKEuS 641ac5c02a Fixed #4352: Ensure that class provides an iterator interface. 2013-03-14 09:00:22 -07:00
PKEuS 14feaa8d39 Refactorizations:
- Fixed lots of cppcheck messages about functions that can be const or static
- Fixed possible nullpointer dereference message in symboldatabase.cpp
- Replaced tokAt(+-1) by next()/previous()
2013-03-12 07:42:00 -07:00
PKEuS 2a312efd6e Adapted testsymboldatabase.cpp to recent changes 2013-03-05 06:46:34 -08:00
PKEuS 66a3555897 Implement initial support for Types in Symboldatabase:
- For each class/struct/union, a Type instance is added to SymbolDatabase::typeList.
- A scope is no longer created for declared but not defined types

Fixed name detection for classes when they are declared like this: "class ::Foo::Sub {..."
2013-03-05 04:33:38 -08:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Robert Reif a0d8fd26fe SymbolDatabase: improved handling of const in function parameters 2013-01-27 02:46:00 +01:00