Paul Fultz II
fa651272f0
Fix 10001: Syntax error on valid C++ code ( #3697 )
2022-01-12 22:04:28 +01:00
Paul Fultz II
ac4f4258a0
Fix 10651: Crash on static template method ( #3633 )
2021-12-16 22:32:44 +01:00
Stefan van Kessel
5770110377
Fixed #10432 (Only the first default argument was copied from the forward declaration;) ( #3530 )
...
Co-authored-by: Stefan van Kessel <stefan.vankessel@muehlbauer.de>
2021-11-15 20:37:46 +01:00
Paul Fultz II
d1181ad8e2
Fix 10506: Hang: template alias (TemplateSimplfier) ( #3466 )
2021-09-25 11:56:39 +02:00
chrchr-github
05acc13582
Shadow variables, const, rename function ( #3456 )
2021-09-15 20:28:58 +02:00
Paul Fultz II
7f358b2bed
Format with uncrustify ( #3388 )
2021-08-07 20:51:18 +02:00
Robert Reif
94dc6c2c3f
fix #10332 (cppcheck crashes) ( #3371 )
2021-08-01 10:31:36 +02:00
Daniel Marjamäki
524e4b8c96
CI; Fix self check warning, pointer can be const
2021-07-20 12:21:01 +02:00
dummyunit
247b2d8c83
Support array types in template simplifier ( #3267 )
2021-05-23 10:40:09 +02:00
Daniel Marjamäki
2c24af02c8
Fixed self-check error. Use Token::simpleMatch for simple pattern.
2021-05-09 23:02:35 +02:00
Daniel Marjamäki
3b37c14b3c
Parser; Partial C++20 support, explicit(bool)
2021-05-09 18:47:02 +02:00
IOBYTE
bd7551411a
fix #10258 (coredump due to (?) template simplification) ( #3228 )
2021-04-22 22:23:01 +02:00
Daniel Marjamäki
b5aaf8d577
Suppress false positive
2021-04-21 14:49:06 +02:00
Daniel Marjamäki
bfb98dbf51
TemplateSimplifier: updated output of uninstantiated c++17 fold expressions
2021-04-21 13:13:11 +02:00
Daniel Marjamäki
35c934c887
Fixed self-check warning
2021-04-20 16:46:05 +02:00
Daniel Marjamäki
04e9c13bc6
TemplateSimplifier; Better handling of c++17 fold expressions and c++20 concepts.
...
c++17 fold expressions are simplified to a __cppcheck_uninstantiated_fold__ if they are not instantiated.
c++20 concepts are skipped/removed by Cppcheck and these will be enforced by the compiler.
2021-04-20 15:40:25 +02:00
IOBYTE
59f7b937f1
fix daca2 gdcm template simplifier crash ( #3221 )
...
This only fixes the crash. The templates that are instantiated are
correct but one template is left uninstantiated. Fixing the missing
instantiation is not easy and will be looked at later.
Co-authored-by: Robert Reif <reif@FX6840>
2021-04-19 09:17:49 +02:00
Daniel Marjamäki
9a9043a07e
Fixed #4349 (Support C++11 variadic templates)
2021-04-17 21:57:21 +02:00
Daniel Marjamäki
42437277dc
Update Copyright year
2021-03-21 20:58:32 +01:00
IOBYTE
b1b7fbb63a
partial revert of b1eaa3021f
( #3174 )
...
It is necessary to use a fake NameAndToken in
mTypesUsedInTemplateInstantiation rather than a Token pointer so the
template simplifiers internal state is kept valid when tokens are
deleted. This prevents a use after free.
Co-authored-by: Robert Reif <reif@FX6840>
2021-03-18 09:15:21 +01:00
IOBYTE
c9f09fc73f
small template simplifier fixes ( #3168 )
...
* small template simplifier optimization
* don't look for template parameter name in default values
* fix cppcheck warning
* add test for TemplateSimplifier::getTemplateParametersInDeclaration()
Also removed TemplateSimplifier::getTemplateParametersInDeclaration()
return value since it wasn't used.
* added another test
Co-authored-by: Robert Reif <reif@FX6840>
2021-03-16 09:31:52 +01:00
IOBYTE
fe4964f22c
fix overloaded template instantiation ( #3160 )
2021-03-04 08:43:22 +01:00
IOBYTE
8c57e2bb14
fix template simplifier overloaded specialized instantiations ( #3154 )
2021-02-28 21:52:14 +01:00
PKEuS
141d2ac215
Refactorization: Improved internal implementation of severity and certainty levels
...
Backported from LCppC.
2021-02-24 22:00:06 +01:00
IOBYTE
2482873029
fix location of forward declaration of specialized template ( #3031 )
2021-01-09 20:00:35 +01:00
IOBYTE
503a5dd441
fix #10081 (Hang: TemplateSimplifier::useDefaultArgumentValues) ( #3021 )
2021-01-06 23:06:50 +01:00
Paul Fultz II
f0b5668436
Fix issue 9890: ValueFlow: known value not found (variable is changed in path that returns) ( #3010 )
2021-01-05 16:49:08 +01:00
Oliver Stöneberg
d59abfd977
fixed clang-tidy warnings ( #3006 )
...
* clang_tidy.cmake: added clang-tidy-11 to list of executables to look for
* .clang-tidy: disabled warnings we are (currently) not interested in
* fixed clang-tidy warnings
2021-01-02 23:10:27 +01:00
Oliver Stöneberg
fbf5858f76
fixed and enabled several clang-tidy warnings ( #2816 )
2021-01-02 19:10:25 +01:00
IOBYTE
e7bdf5f71c
remove cleanupAfterSimplify from the template simplifier ( #2998 )
...
The template simplifier works well enough now so cleanupAfterSimplify is
no longer necessary. In fact cleanupAfterSimplify was introducing a bug
which improperly simplified C++ style casts.
Bugs should be exposed and fixed properly rather than just hiding them.
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-31 09:33:23 +01:00
IOBYTE
277da763aa
fix #10054 (debug: Executable scope 'x' with unknown function.) ( #2994 )
2020-12-30 08:09:34 +01:00
IOBYTE
2a05bc565d
insert simplified types for implicit template type deduction ( #2952 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-15 22:28:58 +01:00
IOBYTE
7fc03c6030
fix #10032 (Syntax error if first function in a struct is a template function) ( #2940 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-11 07:01:20 +01:00
IOBYTE
6103da59be
add column number to TokenList::addtoken ( #2939 )
2020-12-08 10:34:23 +01:00
IOBYTE
8d9f0b3528
fix #9394 ("debug: Executable scope 'x' with unknown function." with … ( #2935 )
2020-12-06 22:08:42 +01:00
IOBYTE
9c51d4c12d
instantiate nested templates in the proper order ( #2930 )
2020-12-04 08:04:16 +01:00
IOBYTE
2bbc7abedc
fix overloaded function lookup for explicit instantiations ( #2929 )
2020-12-01 09:43:16 +01:00
Daniel Marjamäki
8a1c16a560
Tokenizer: add daca debug messages when right angle brackets in templates are not handled well
2020-11-29 16:07:56 +01:00
IOBYTE
1ea89bcad8
add support for template constructors ( #2911 )
2020-11-24 07:21:37 +01:00
Daniel Marjamäki
4a2e082d85
Revert "GUI: restore default tab in ProjectFileDialog"
...
This reverts commit 39564c9e6c
.
2020-11-23 20:18:06 +01:00
Daniel Marjamäki
39564c9e6c
GUI: restore default tab in ProjectFileDialog
2020-11-23 19:27:14 +01:00
IOBYTE
c4b3d4cd77
fix #9983 (TemplateSimplifier: template not simplified : f(0,0);) ( #2905 )
...
Currently template type deduction for functions only works for single
template argument single function argument functions with a literal
argument.
This patch starts to add support for single template argument multiple
function argument functions. It correctly handles functions with
multiple arguments of the same type. It also handles a mix of template
and non-template arguments.
It does not add support for overloading non-template arguments.
It does not add support for multiple parameter template functions.
It does not add support for type deduction from variable arguments.
Co-authored-by: Robert Reif <reif@FX6840>
2020-11-17 06:51:32 +01:00
IOBYTE
e785885b4d
fix #9975 (Template method not simplified) ( #2894 )
2020-11-10 21:19:04 +01:00
IOBYTE
4e4108dc8b
fix daca insighttoolkit crash in template simplifier ( #2826 )
...
Don't count deleted instantiations in the recursive count.
I can't reduce the daca code because creduce requires a preprocessed
file to reduce and the problem doesn't show up when the file is
preprocessed with cppcheck.
There is no test because I couldn't reduce the problem files.
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-28 22:51:13 +02:00
Robert Reif
a52ce7379a
fix #9886 (Hang in TemplateSimplifier (gcc/gcc/testsuite/g++.dg/cpp0x/decltype34.C))
2020-09-10 14:47:59 -04:00
IOBYTE
2106e30304
fix template namespace bug ( #2780 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-07 17:45:19 +02:00
IOBYTE
2db0d2878b
fix daca crash in TemplateSimplifier::getNewName ( #2772 )
...
Don't add the same template instantiation multiple times.
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-04 07:08:28 +02:00
IOBYTE
7cf3909275
fix #9854 (Syntax error on valid C++ code) ( #2756 )
2020-08-26 07:00:58 +02:00
shaneasd
45fc6a0eeb
Test for syntax error in nested templates ( #2746 )
2020-08-25 07:14:44 +02:00
Paul
600919f624
Remove redundant conditions
2020-06-29 15:13:06 -05:00
Daniel Marjamäki
98bf0d41aa
TemplateSimplifier; Clarify information message when max recursion limit is reached
2020-06-26 12:59:40 +02:00
Daniel Marjamäki
34468f3c1a
Template simplifier; Write information message when recursion limit is reached.
2020-06-24 20:30:03 +02:00
Ken-Patrick Lehrmann
5c1a2db434
Fix handling of c++ casts in template expansion
...
Cast were not expanded properly: the `<` was not taken into account in
typeindentlevel, so we would then miss a `>`, resulting in syntaxError.
2020-06-16 19:36:04 +02:00
Oliver Stöneberg
4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit ( #2640 )
2020-05-26 20:13:56 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
2020-05-23 07:16:49 +02:00
Daniel Marjamäki
4c5310433c
astyle formatting
...
[ci skip]
2020-05-22 08:48:28 +02:00
Paul Fultz II
8301fa8244
Fix issue 8144: valueFlowBeforeCondition: struct ( #2645 )
2020-05-21 08:47:48 +02:00
PKEuS
ade253a730
Optimization: Reduced memory consumption of token list
...
- allocate memory for mTemplateSimplifierPointers only if necessary
- reordered member variables in TokenImpl
2020-05-19 08:40:24 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b
Revert "Update copyright year"
...
This reverts commit 6eec6c4bd5
.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5
Update copyright year
2020-05-10 11:11:34 +02:00
Oliver Stöneberg
1af959af2c
fixed -Wextra-semi-stmt Clang warnings ( #2553 )
...
* fixed -Wextra-semi-stmt Clang warnings
* adjusted REDIRECT macro to require a semicolon
* testmathlib.cpp: rolled back accidental change
2020-04-21 17:27:51 +02:00
Daniel Marjamäki
8dd0a9241c
TemplateSimplifier: Simplification of const types
2020-04-05 13:51:58 +02:00
Paul Fultz II
392060aefe
Fix issue 7804: ValueFlow: possible value in second if body ( #2543 )
2020-02-19 07:55:04 +01:00
IOBYTE
4d58d9fc87
fix daca chromium crash ( #2527 )
2020-02-09 11:19:36 +01:00
Dmitry-Me
e9b7e7811b
Remove unreachable code and repeated computation
2020-02-05 18:20:43 +03:00
Dmitry-Me
c8df734c07
Merge overlapping patterns
2020-02-04 18:35:30 +03:00
IOBYTE
0e4efea530
fix #9539 (Syntax error for valid C++14 code) ( #2446 )
2019-12-12 20:50:20 +01:00
IOBYTE
f554a71dea
fix #9495 (Crash when parsing angle brackets in template with type traits (assertion failure)) ( #2407 )
2019-11-29 09:44:27 +01:00
IOBYTE
590aeea8f8
Fix #9483 (Assertion `tok && tok->str() == ">"' failed) ( #2381 )
2019-11-20 07:02:25 +01:00
IOBYTE
f88ae21d8f
Fix #9467 (False positive on local variable when template specialization is used) ( #2357 )
2019-11-13 21:34:27 +01:00
Paul Fultz II
c75bbbe253
Fix issue 9404: False positive: Either the condition 'if(x)' is redundant or there is possible null pointer dereference: a->x ( #2322 )
...
* Fix issue 9404: False positive: Either the condition 'if(x)' is redundant or there is possible null pointer dereference: a->x
* Use simpleMatch
* Add a test case for the FP
* Check if expression is changed
* Check for no return scope
* Use simpleMatch
2019-11-08 08:11:41 +01:00
IOBYTE
02e7f4f61c
Fix template templates where the template template parameter is not the first parameter. ( #2309 )
2019-10-30 12:12:47 +01:00
Oliver Stöneberg
1fa4df419a
avoid some unnecessary copies in emplace_back() calls ( #2194 )
2019-09-28 20:22:46 +02:00
IOBYTE
4475c4c7e2
template simplifier: fix syntax error ( #2218 )
2019-09-26 10:31:19 +02:00
Oliver Stöneberg
eac040a00b
Various clang-tidy fixes ( #2192 )
...
* use range loops
* removed redundant string initializations
* use nullptr
* use proper boolean false
* removed unnecessary continue from end of loop
* removed unnecessary c_str() usage
* use emplace_back()
* removed redundant void arguments
2019-09-25 15:25:19 +02:00
IOBYTE
12f93b63a8
template simplifier: fix simplification of "< %num% %comp% %num% >" ( #2214 )
...
* template simplifier: fix simplification of "< %num% %comp% %num% >"
* fix test to not fail on 32 bit platforms
2019-09-25 12:06:29 +02:00
IOBYTE
8c5cf8c029
Fixed #9046 syntaxError ( #2180 )
...
* Fixed #9046 syntaxError
* fix another syntax error
* fix some more syntax errors
2019-09-20 12:35:01 +02:00
Oliver Stöneberg
de9f489b08
use range loops / constness ( #2181 )
...
* use range loops / constness
* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
IOBYTE
4e222afa2c
template simplifier: ignore alias template definitions with syntax errors ( #2169 )
...
Is not allowed to define a type in an alias template definition.
This code:
template<int N>
using A1 = struct B1 { static auto constexpr value = N; };
A1<0> a1;
produces this output:
2: } ;
3: struct B1 { static const auto value = 0 a1 ;
test.cpp:2:57: error: Analysis failed. If the code is valid then please
report this failure. [cppcheckError]
using A1 = struct B1 { static auto constexpr value = N; };
^
because it tries to instantiate the invalid alias template definition
and generates garbage code.
2019-09-11 19:31:15 +02:00
IOBYTE
639c29eb5c
Fix #9338 (Regression: Syntax error on valid C++) ( #2156 )
...
* Fix #9338 (Regression: Syntax error on valid C++)
* fix cppcheck warning
2019-09-09 21:46:21 +02:00
IOBYTE
59fdbd8435
Fix #9337 (Syntax error on valid C++) ( #2152 )
2019-09-07 09:09:04 +02:00
IOBYTE
e5220bdf0c
make ellipsis ... a single token ( #2143 )
...
* make ellipsis ... a single token
Using cppcheck -E to preprocess code with ellipsis produces output that
can't be compiled because ... is split into 3 tokens.
* try to fix addon
2019-09-04 08:07:30 +02:00
IOBYTE
fd403bf7e6
template simplifier: only add recursive instantiation if its arguments are a constant expression ( #2138 )
2019-09-02 06:51:19 +02:00
IOBYTE
3a1aec8850
template simplifier: ignore friend templates ( #2122 )
...
* template simplifier: ignore friend templates
friend templates were interpreted as variable templates
* fix cppcheck warning
2019-09-01 09:56:33 +02:00
IOBYTE
28a95802a2
template simplifier: fix syntax error false positive (an expression can't be a template) ( #2115 )
...
https://stackoverflow.com/questions/57590411/cppcheck-syntax-error-with-using-typedef
2019-08-27 06:37:58 +02:00
Daniel Marjamäki
c3a27eb8c1
Fix a few cppcheck internal warnings
2019-08-17 16:02:58 +02:00
IOBYTE
04bb6c0d1f
template simplifier: fix new daca crashes ( #2093 )
2019-08-17 07:38:07 +02:00
Daniel Marjamäki
95ac8db584
TemplateSimplifier: Set column number for expanded tokens
2019-08-15 15:22:56 +02:00
IOBYTE
5fc5e3728d
template simplifier: refactor TemplateSimplifier::TokenAndName into a… ( #2073 )
...
* template simplifier: refactor TemplateSimplifier::TokenAndName into a class
assert when more than one family flag is set
* fix function parameter names
2019-08-10 08:42:12 +02:00
Armin Müller
785cc69644
Typos found by running "codespell" ( #2072 )
2019-08-08 21:05:28 +02:00
IOBYTE
c6c50567cf
Fix #9250 (Regression: crash in gcc testsuite) ( #2067 )
...
* Fix #9250 (Regression: crash in gcc testsuite)
* fix cppcheck warning
2019-08-07 08:05:02 +02:00
IOBYTE
7ebc9d1b5f
Fix #9249 (Syntax error on valid C++) ( #2062 )
2019-08-04 10:24:44 +02:00
IOBYTE
2da83df37b
Fix #9246 (Syntax error on C++ code) ( #2061 )
2019-08-03 08:15:06 +02:00
IOBYTE
0d1685cd29
Fix #9178 example with instantiation ( #2059 )
2019-08-02 07:53:39 +02:00
orbitcowboy
a9bdf99e07
std.cfg: Added *experimental* support for math constants liken M_PI. These are *NOT* standard, but they are supported by GCC/Clang and VS.
2019-07-31 11:11:01 +02:00
rebnridgway
e629f9a90f
Calculate token scopes in advance rather than as the tokenlist is iterated ( #2038 )
...
* Removed redundant scope calculation
* Add scope propagation code to insertToken
* Add relevant scope code to Token class
* Add code to calculate the scope of Tokens
* Add calculateScopes method to class
* Add missing include for shared_ptr
2019-07-31 09:19:27 +02:00
IOBYTE
9436f72a94
Fix daca dnsdist crash ( #2053 )
2019-07-31 09:18:43 +02:00
IOBYTE
07ac6c5f08
Fix ternary operator simplification to accept template parameters. ( #2048 )
...
Also simplify decltype of bool and numeric literals in template
arguments.
2019-07-28 21:52:52 +02:00
IOBYTE
badc573b80
Fix #9224 (Performance regression in template parsing: 250x - 1200x slower) ( #2046 )
2019-07-28 09:25:18 +02:00