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
Daniel Marjamäki
040d2f0012
Use simplecpp lexer in test cases
2017-05-18 21:52:31 +02:00
Daniel Marjamäki
59335f80d2
Try to fix windows build. Reduce header dependencies
2017-05-17 15:38:31 +02:00
Daniel Marjamäki
6230919976
Skip 'Stringification => Tokenize' step
2017-05-17 14:57:54 +02:00
Alexander Mai
c1cdcc158f
Run astyle. Fix some Doxygen issues
2017-05-06 11:57:02 +02:00
amai2012
3e11eb9dca
#8050 cppcheckError: 0xFFFFFFul -> 16777215ULU. Don't add a suffix 'U' if there is already a suffix present.
2017-05-05 14:47:58 +02:00
Daniel Marjamäki
589fabd0b1
Fixed #8027 (hang after AST_MAX_DEPTH is exceeded in array initialization)
2017-04-27 20:53:27 +02:00
Daniel Marjamäki
d9f72d5f8c
AST: Handle 'x = { [ID] = 1, .. }' when ID is unexpanded macro
2017-04-26 22:35:04 +02:00
Daniel Marjamäki
1039c710e4
Fixed #8017 (AST: wrong ast for extra comma 's={1,}')
2017-04-22 11:23:11 +02:00
Daniel Marjamäki
e827119856
Fix testrunner InternalError
2017-04-21 21:02:46 +02:00
Daniel Marjamäki
902eb87a8a
Fixed #8016 (AST: wrong ast for 'x=(s){...};')
2017-04-21 17:44:11 +02:00
Daniel Marjamäki
7a26e046a8
Fixed #8001 (AST: Wrong AST for lambda function with 'std::string const&' result type)
2017-04-18 21:21:30 +02:00
Daniel Marjamäki
0edb0dbf3c
Fix redundant assignment found by Cppcheck
2017-04-17 22:33:15 +02:00
Daniel Marjamäki
d911eeba75
astyle formatting
...
[ci skip]
2017-04-17 22:16:02 +02:00
Daniel Marjamäki
bb015c6a2b
Fixed #8006 (AST: Wrong tree with complex for loops and casts)
2017-04-17 21:11:53 +02:00
Daniel Marjamäki
4d1a64301c
AST: Fixed Match pattern '|*' => '*|'
2017-04-10 23:44:30 +02:00
Daniel Marjamäki
632a6b664c
AST: Harden handling of C++11
2017-04-10 23:29:15 +02:00
Daniel Marjamäki
2c43075ece
AST: weird clang syntax
2017-04-10 23:05:41 +02:00
Daniel Marjamäki
5e1b6aee8c
AST: Fix hang for weird VLA code
2017-04-10 22:17:34 +02:00
Daniel Marjamäki
ffeadbdde4
AST: improved handling for struct initialization 's = { [0] = 123 }'
2017-04-10 07:25:18 +02:00
Daniel Marjamäki
d92c529aa6
AST: Fix wrong handling of struct initialization, caused hang
2017-04-09 22:06:13 +02:00
Daniel Marjamäki
45d2d66df3
Remove redundant space in Token::Match pattern
2017-04-09 19:27:11 +02:00
Daniel Marjamäki
e6005dfa3c
AST: Fix AST for lambda '[&]{..}'
2017-04-09 17:49:55 +02:00
Daniel Marjamäki
392a06a44b
AST: better handling of '(struct X){...}'
2017-04-06 21:28:13 +02:00
Daniel Marjamäki
e6ed08c4d8
Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression))
2017-04-05 11:00:02 +02:00
Daniel Marjamäki
abb43b6a81
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-04-02 19:44:33 +02:00
Daniel Marjamäki
1faca91c1d
Added 'endsWith' utility function. This will make compiling the democlient easier.
2017-04-01 18:14:18 +02:00
Daniel Marjamäki
c18fe8262b
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-03-19 07:26:11 +01:00
Daniel Marjamäki
ecc59859e1
Don't simplify _Bool in TokenList
2017-03-04 11:13:28 +01:00
Daniel Marjamäki
f0c353abcb
TokenList: append 'U' if needed on hexvalues
2017-03-04 08:47:53 +01:00
Matthias Krüger
064a4aa4cc
improve constness of functions as per cppchecks suggestions.
2017-01-07 14:31:03 +01:00
Stefan Weil
57b57428c2
Fix some typos in comments (found by codespell)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki
c329887bfe
use const
2016-11-20 15:44:20 +01:00
Frank Zingsheim
c8ff96fe8f
Fixed #6180 (Usage of variable after std::move or std::forward)
2016-11-20 15:14:49 +01:00
Simon Martin
f816fb811e
Ticket #7680 : Properly handle ::delete during memory leak checks.
2016-09-10 14:55:50 +02:00
Robert Reif
100c4276ea
Fixed #7424 (value type: wrong sign)
2016-03-18 10:30:57 +01:00
Alexander Mai
89c9528fdc
Small optimization of TokenList::validateAst()
2016-02-02 08:55:26 +01:00
Alexander Mai
a288d5eb16
#7027 TokenList::validateAst() did not detect broken AST with endless recursion
2016-01-31 22:16:58 +01:00
Daniel Marjamäki
c0056d2455
Fixed #7347 (AST: wrong ast when template variable is declared and initiailized in if 'if (A::B<C> abc = 123)')
2016-01-26 10:40:44 +01:00
Daniel Marjamäki
7663b6ee75
Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;')
2016-01-25 10:29:24 +01:00
Daniel Marjamäki
79e663dd6f
Settings: Remove '_' prefix for public member variables
2016-01-03 16:18:17 +01:00
Daniel Marjamäki
91d0f0fee0
astyle formatting
...
[ci skip]
2016-01-03 09:38:03 +01:00
Daniel Marjamäki
ed12b4dc44
Fixed #7253 (AST wrong on nested reinterpret_cast)
2016-01-03 09:37:38 +01:00
Lauri Nurmi
996c9244d8
Update copyright year to 2007-2016.
2016-01-01 15:34:45 +02:00
Alexander Mai
5b6758b03b
Add some debugging code (inspired by #6021 )
2015-12-27 17:38:15 +01:00
Daniel Marjamäki
f09dded7b1
TokenList: Better handling of '1++a' and 'a++1'
2015-12-27 14:57:22 +01:00
Alexander Mai
e9635fd393
#7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration
2015-12-26 23:51:10 +01:00
amai2012
081f443b2a
#7235 segmentation fault (invalid code) in TokenList::createAst
2015-12-26 20:26:07 +01:00
Dmitry-Me
05cb4e16fe
Fix misspelled word
2015-12-25 11:51:08 +03:00
Dmitry-Me
bd45c71d8d
No need to clear empty strings
2015-12-24 10:16:58 +03:00
Daniel Marjamäki
3f386af21c
astyle formatting
2015-12-23 10:26:12 +01:00