Commit Graph

280 Commits

Author SHA1 Message Date
Daniel Marjamäki e17ddfd964 Changed AST for variable declarations with initializations 2019-03-09 19:09: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
Daniel Marjamäki 6ca1aba4a7 UninitVar: Fix --experimental-fast issues 2019-02-10 19:00:01 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +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
Daniel Marjamäki e0b64ec7a9 Fixed #8884 (AST: handle xs... template argument) 2018-12-12 19:00:14 +01:00
Daniel Marjamäki 982f7dc2b3 relative paths: show {code} properly when there are relative paths 2018-11-18 16:08:08 +01:00
Daniel Marjamäki 5d086d60ad Fixed #8844 (snd: Wrong varid and ast) 2018-11-14 21:05:09 +01:00
Daniel Marjamäki 8327aab127 Fixed #8628 (Wrong AST in case) 2018-11-10 21:32:06 +01:00
Daniel Marjamäki f8b0584f6a replace 'constexpr' with 'const' 2018-11-03 19:22:51 +01:00
Armin Müller acf2035a53 Typos found by running "codespell" (#1461) 2018-11-03 07:34:27 +01:00
rikardfalkeborn 88008fedb1 findLambdaEndToken handle explicit type (#1458)
* findLambdaEndToken: Add tests

* Add handling of explicit return in findLambdaEndToken()

* Use AST in findLambdaEndToken()

* Fix ast when lambda is mutable
2018-10-31 12:36:08 +01:00
Daniel Marjamäki 2e4f317c0b Revert "Remove FIXME"
This reverts commit 749699c632.
2018-10-22 21:03:30 +02:00
Daniel Marjamäki 15160f1691 Fixed #8788 (AST Broken error from assigning lambda to variable) 2018-10-22 17:25:01 +02:00
Daniel Marjamäki 749699c632 Remove FIXME 2018-10-22 12:45:34 +02:00
Daniel Marjamäki dc38681a56 Remove FIXME in AST validation. Ticket #8749 2018-10-22 11:37:24 +02:00
Daniel Marjamäki 465db2dff7 Fixed #8786 (internalAstError on valid code with C style cast) 2018-10-18 20:17:23 +02:00
Paul Fultz II 9cf092657c Skip some ast errors to avoid regressions (#1422)
* Skip some ast errors to avoid regressions

* Use simpleMatch

* Skip operator functions

* Add a test for issue 8788
2018-10-13 18:38:44 +02:00
Daniel Marjamäki 9dccc4037b Fixed #8747 (Syntax error, AST broken (a = --*b)) 2018-09-27 19:26:08 +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
amai2012 9f5e648b9f Enhance debug output for AST syntax error (inspired by #8747) 2018-09-10 08:55:46 +02:00
Paul Fultz II fa40b821e6 Fix issue 8740: Add a pass to check for valid operators (#1372) 2018-09-08 21:10:34 +02:00
Daniel Marjamäki 3a8bdad20a Fixed #8232 (segmentation fault on valid C++ code in isOppositeCond()) 2018-09-04 18:10:31 +02:00
Daniel Marjamäki 807fbfd318 Renamed _isC and _isCPP 2018-06-16 16:28:03 +02:00
Daniel Marjamäki d08b6e02b7 renamed _files to mFiles 2018-06-16 16:23:55 +02:00
Daniel Marjamäki cc521bef99 renamed _tokensFrontBack to mTokensFrontBack 2018-06-16 16:22:35 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
Matthias Krüger 0771a81969 Revert "tokenlist::iscast(): save a few pointer dereferences."
This reverts commit e187fdb696.
2018-06-02 15:57:56 +02:00
Matthias Krüger e187fdb696 tokenlist::iscast(): save a few pointer dereferences. 2018-06-02 13:19:22 +02:00
rebnridgway 42a65c5160 Fix crash bug #8579 (#1238)
* Added declaration for deletePrevious function

* Added definition for deletePrevious function

* Fixed crash from deleteThis invalidating pointers

The crash was caused by deleteThis() invalidating the pointer to a constant variable usage.  This happened when a usage followed an assignment.  This fixes bug #8579.

* Added tokensFront to match tokensBack

This means deletePrevious can set the list's front if necessary.

* Initialised tokensFront in appropriate places

* Switched to using default Token constructor

* Switched to using Token default constructor

* Switched to using default constructor for Token

* Added missing argument to Token constructor

* Changed to use default constructor for Tokens

* Switched to using default constructor for Tokens

* Switched to using default constructor for Token

* Added new test for deleting front Token

Also made sure to use the correct constructor for Token in other tests.

* Syntax error

* Replaced tokensFront and tokensBack with a struct

This decreases the size of the Token class for performance purposes.

* Replaced tokensFront and tokensBack with a struct

* Added tokensFrontBack to destructor

* Reworked to use TokensBackFront struct

Also ran astyle.

* Reworked to use TokenList's TokensFrontBack member

* Reworked to use TokensFrontBack struct

* Reworked to use TokensFrontBack struct

* Reworked to work with TokensFrontBack struct

* Removed unnecessary scope operator

* Added missing parentheses

* Fixed syntax error

* Removed unnecessary constructor

* Default constructor now 0-initialises everything

This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.

* Fixed unsafe null check

* Added missing explicit keyword

* Fixing stylistic nits

Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.

* Fixing stylistic nits

Removed default constructor and replaced it with a single-argument constructor with a default value.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.
2018-05-25 07:15:05 +02:00
PKEuS 3d860e6f36 Bump simplecpp 2018-05-14 13:00:22 +02:00
Daniel Marjamäki ab6167e3e6 TokenList::validateAst: optimised ~25% 2018-05-09 12:36:58 +02:00
Simon Martin a451a5b598 Ticket #8436: Handle C++11 initializations within ternary operator. (#1174) 2018-04-21 11:30:07 +02:00
Daniel Marjamäki 210b921062 Fixed #8462 (AST: no ast created for 'e = { std::move(address),httpPort, (httpsPort) };') 2018-03-27 13:44:28 +02:00
Daniel Marjamäki 380ecc408f Fixed #8418 (AST: wrong ast for throw expression) 2018-03-10 22:30:21 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 8c33a95b49 Refactoring: moved method from Tokenizer to TokenList 2018-01-07 14:07:34 +01: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 b9b47809f9 Fixed #8197 (iscast: '(b)&1' is not a cast) 2017-09-08 22:52:16 +02:00
Matthias Krüger 58a64702b7 add "internalAstError" id so we can easily track ast errors on daca. 2017-09-05 22:49:16 +02:00
Daniel Marjamäki 713f607168 Fixed #8156 (wrong ast for 'z = (x & (unsigned)1) | (y & (unsigned)2);') 2017-08-26 23:25:45 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
Daniel Marjamäki 462ae455c8 Fix issue detected by Coverity, missing check if _settings is null 2017-08-02 08:04:35 +02:00
Daniel Marjamäki cdeae918a8 Fix issue detected by Coverity (ternary operator false expression is unreachable) 2017-07-31 17:58:07 +02:00
Daniel Marjamäki 453058c059 AST: Better handling of C++11 initializer lists 2017-06-09 22:35:46 +02:00
Daniel Marjamäki fd74d455ce AST: Better handling of case 2017-06-08 15:32:35 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki dda5556ded Fixed #8034 (AST: better handling for c++ type initialization) 2017-05-24 20:24:56 +02:00
Daniel Marjamäki 5444875f89 Fixed #8034 (AST: better handling for c++ type initialization) 2017-05-24 20:18:31 +02:00
Daniel Marjamäki 899615c1e4 update simplecpp includes
[ci skip]
2017-05-18 22:26:07 +02:00