Commit Graph

2382 Commits

Author SHA1 Message Date
Daniel Marjamäki c5a512338e --check-headers=no: remove more templates in headers that are not used in the source file 2019-03-03 20:18:54 +01:00
Daniel Marjamäki 41db8afe87 --check-headers=no: remove templates in headers that are not used in the source file 2019-03-03 12:56:37 +01:00
Daniel Marjamäki eb109af00f Replace Token::simpleMatch with Token::Match for complex pattern 2019-03-03 12:40:55 +01:00
Daniel Marjamäki 59ec5f961f --check-headers=no: remove types in headers that are not used in the source file 2019-03-03 12:36:33 +01:00
Daniel Marjamäki 411a3f09f7 --check-headers=no: Remove unused function declarations 2019-03-03 09:18:12 +01:00
IOBYTE b222953bae template simplifier: only constant fold template instantiation arguments (#1721)
* template simplifier: only constant fold template instantiation arguments

* Fix travis build.
2019-03-03 07:40:55 +01:00
Daniel Marjamäki f5c274b3b1 Added '--check-headers=no' option. 2019-03-02 19:52:15 +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
Simon Martin eaaff30e65 Ticket #8878: Properly simplify typedefs within template instantiations. (#1656) 2019-02-10 09:45:33 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
IOBYTE 7025254c26 Fixed #8969 (syntax error: template) (#1647)
Fixed template detection to handle multi-token template parameters.
2019-02-07 08:50:49 +01:00
IOBYTE 1faae52d06 Fixed #8960 ("(debug) Unknown type 'x'." with alias in template class alias) (#1643)
* Fixed #8960 ("(debug) Unknown type 'x'." with alias in template class alias)

This commit adds non-template type alias support to the template
simplifier.  Only relatively simple type aliases are supported at this
time. More complex types will be added later.

--debug-warnings will show unsupported type aliases.

Type alias support will be removed from the symbol database in the
future.  Type alias tests have been removed from the symbol database
tests.

* Add the changes.

* Fix codacy warning.

* Fix travis warnings.
2019-02-05 08:52:23 +01:00
Daniel Marjamäki b7631b0390 Add more timers in tokenizer 2019-02-04 21:13:59 +01:00
Daniel Marjamäki ae001d4336 Fixed #8957 (Tokenizer::setVarId: varid not set when lambda function is used) 2019-02-03 08:57:04 +01:00
IOBYTE 5c0ec782f1 Add ability to time simplifyTemplates. (#1640) 2019-02-01 18:17:18 +01:00
IOBYTE 1acbdde302 Fixed #7417 ("syntax error" in valid code containing explicitly specialised variable template) (#1604) 2019-01-18 21:12:39 +01:00
IOBYTE 817c748e4d Fixed #5953 (debug: varid0: Function::addArguments) (#1567) 2019-01-05 19:42:04 +01:00
Daniel Marjamäki 615903c6be Improve syntax errors for unmatched (){}[] 2019-01-05 11:56:21 +01:00
Daniel Marjamäki 19514331fb Fixed #8907 (unknown macro not detected) 2019-01-01 19:30:13 +01:00
Daniel Marjamäki 04d3672bde Fixed #7203 (Better syntax error, handle array declaration with @) 2019-01-01 09:45:41 +01:00
IOBYTE 48c960f56c template simplifier: better detection of template functions (#1539)
* template simplifier: better detection of template functions

* fix comment
2018-12-22 10:05:10 +01:00
IOBYTE c31331d085 template simplifier: fix explicit instantiation with types starting with const and ending in * and &. (#1530) 2018-12-19 21:59:59 +01:00
PKEuS 34874dd94f Optimization: Removed unnecessary calls to simplifyPath(). The Caller should do this, and our callers (mainly the test suite) more or less do so, as they all supply just dummy paths ("test.cpp") 2018-12-18 20:33:45 +01:00
IOBYTE 1cba78090c Fix const anonymous struct. (#1527) 2018-12-18 08:15:12 +01:00
Daniel Marjamäki f26549e5ab Fixed #8896 (Tokenizer: Anonymous struct) 2018-12-15 08:42:35 +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
Daniel Marjamäki bd0a935d8a Tokenizer: Improved handling of compiler extensions that use @ (see https://sourceforge.net/p/cppcheck/discussion/general/thread/8f618cb0a3) 2018-12-04 19:33:39 +01:00
Daniel Marjamäki 49413b7d4c Tokenizer: Add simplifyAt to handle some nonstandard code with @ 2018-12-04 16:52:41 +01:00
Daniel Marjamäki 8087cfed5d Fixed #8627 (Tokenizer::setVarIdPass2: constructor parameter) 2018-12-02 09:28:05 +01:00
Daniel Marjamäki 96929c53c0 Fixed #8873 (Add syntaxError when there is no RHS for +-) 2018-12-01 17:29:41 +01:00
Colomban Wendling cad4e4ab20 Fix handling of `sizeof &var` (#1498)
Fixes https://trac.cppcheck.net/ticket/8870
2018-11-30 13:53:58 +01:00
Daniel Marjamäki 9ef3c79bc6 Fixed #8851 (Crash in valueFlowContainerForward (daca@home: pbbam)) 2018-11-18 20:18:55 +01:00
Daniel Marjamäki 69f2e0938a VarId: Improved varids for struct members (#8844) 2018-11-14 19:11:35 +01:00
Daniel Marjamäki 152be6df63 Report 'unknown macro' as information message with id unknownMacro 2018-11-13 20:14:56 +01:00
Daniel Marjamäki a50eb56d8d Extend 'Unknown macro' check 2018-11-13 18:30:40 +01:00
Daniel Marjamäki e6a5e0f752 Warn when there is a unknown macro 2018-11-13 16:49:15 +01:00
Daniel Marjamäki 93cde415a7 Fixed #7988 (variable in condition gets wrong varid) 2018-11-11 07:50:25 +01:00
Daniel Marjamäki 148f257c6b Fixed #8838 (False positive on overridden virtual function that is marked both const and final) 2018-11-10 21:57:50 +01:00
Daniel Marjamäki f8b0584f6a replace 'constexpr' with 'const' 2018-11-03 19:22:51 +01:00
Daniel Marjamäki 6138294e3d Fixed #8818 (AST broken: restrict) 2018-11-03 11:05:38 +01:00
Daniel Marjamäki 9741239b2f Fixed #8824 (False positive: uninitialized variable (regression)) 2018-11-03 10:31:55 +01:00
Daniel Marjamäki a4afcb5995 Revert "Fixed #8818 (AST broken: restrict)"
This reverts commit e7d61f399a.
2018-11-02 21:07:37 +01:00
Daniel Marjamäki 0cc4555337 Revert "Tokenizer: Do not remove 'constexpr'"
This reverts commit 2f400b40ba.
2018-11-02 21:07:24 +01:00
Daniel Marjamäki 2f400b40ba Tokenizer: Do not remove 'constexpr' 2018-11-02 20:32:12 +01:00
Daniel Marjamäki e7d61f399a Fixed #8818 (AST broken: restrict) 2018-11-02 20:28:49 +01:00
Paul Fultz II 2b6cc33dc6 Fix issue 8757: Throw syntax error on invalid code (#1378)
* Fix issue 8757: Throw syntax error on invalid code

* Fix FP with lambda returns

* Remove double percent

* Check more keywords

* Skip preprocessor directives

* Check for valid PP directive

* Fix preprocessor check

* Dont check for preprocessor directives
2018-10-28 17:17:53 +01:00
Daniel Marjamäki c483bcb12b Fixed testrunner 2018-10-22 00:28:09 +02:00
Daniel Marjamäki f9b132e831 Tokenizer::simplifyTypedef: Fix bug with arrays 2018-10-21 21:15:34 +02:00
Daniel Marjamäki 14afc3fd3a Fixed #8796 (Tokenizer::simplifyCompoundAssignment: Wrong simplification of return) 2018-10-20 21:33:43 +02:00
Daniel Marjamäki 29feaa5a51 Tokenizer: Avoid constant folding 2018-10-20 10:51:50 +02:00