Commit Graph

492 Commits

Author SHA1 Message Date
PKEuS 1275b5275e
LCppC backport: Various optimizations (#4182)
* Optimization: Use Token::eIncDecOp instead of expensive Token::Match calls

Merged from LCppC.

* Small Optimizations: - Moved a std::set that is only need during initialization of SymbolDatabase to function scope - Use std::vector instead of std::list

Merged from LCppC.

* Optimization: Refactorized various Token::Match calls and surrounding conditions

Merged from LCppC.

* Refactorization: Cleanup usage of std::multimap

Merged from LCppC.
2022-06-08 16:58:57 +02:00
Oliver Stöneberg d36e05af28
enabled and fixed `modernize-use-emplace` clang-tidy warnings (#4165)
* enabled and fixed `modernize-use-emplace` clang-tidy warnings

* avoid unnecessary creation of temporaries in `emplace_back()` calls
2022-06-03 15:09:29 +02:00
chrchr-github 7fbb9c7c13
Fix #10980 FN constVariable with range-based for loop (#4144)
* Fix #10980 FN constVariable with range-based for loop

* Format

* nullptr check

* Restrict scopes

* Add const

* Undo

* Add more const
2022-05-29 17:06:33 +02:00
chrchr-github 55cb396d18
Fix #10494 Same template name confuses check (#4011) 2022-04-13 12:25:21 +02:00
Oliver Stöneberg 45158ec064
cleaned up includes based on include-what-you-use (#4007)
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
chrchr-github 172aafdeb8
Fix #7908 FN: redundant assignment in loop (#3650) 2022-02-22 09:51:44 +01:00
chrchr-github 18e00bb4fd
Fix #10817 Crash in checkPassByReference() / #10810 Stack overflow with decltype / #10763 Crash on invalid code (#3840)
* Fix #10817 Crash in checkPassByReference()

* Format

* Fix #10810 Stack overflow with decltype

* Fix #10763 Crash on invalid code in TemplateSimplifier::templateParameters
2022-02-18 12:59:21 +01:00
Oliver Stöneberg 6e57cc4323
small utils.h cleanup (#3821) 2022-02-11 19:44:08 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 8f7770f512
added an include-what-you-use GitHub Action (#3759) 2022-02-01 17:19:19 +01:00
chrchr-github 127b3bb1c4
Fix #9471 FP unreadVariable caused by invalid template injection (#3783) 2022-02-01 17:15:27 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
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